Search in sources :

Example 1 with Valid

use of org.apache.openmeetings.db.entity.room.Invitation.Valid in project openmeetings by apache.

the class InvitationForm method onInitialize.

@Override
protected void onInitialize() {
    add(subject, message);
    recipients.setLabel(Model.of(getString("216"))).setRequired(true).add(new AjaxFormComponentUpdatingBehavior("change") {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            url.setModelObject(null);
            updateButtons(target);
        }
    }).setOutputMarkupId(true);
    add(new AjaxCheckBox("passwordProtected") {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            InvitationForm.this.getModelObject().setPasswordProtected(getConvertedInput());
            passwd.setEnabled(getConvertedInput());
            target.add(passwd);
        }
    });
    RadioGroup<Valid> valid = new RadioGroup<>("valid");
    valid.add(new AjaxFormChoiceComponentUpdatingBehavior() {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            boolean dateEnabled = InvitationForm.this.getModelObject().getValid() == Valid.Period;
            target.add(from.setEnabled(dateEnabled), to.setEnabled(dateEnabled), timeZoneId.setEnabled(dateEnabled));
        }
    });
    add(valid.add(new Radio<>("one", Model.of(Valid.OneTime)), new Radio<>("period", Model.of(Valid.Period)), new Radio<>("endless", Model.of(Valid.Endless))));
    add(passwd);
    Invitation i = getModelObject();
    passwd.setLabel(Model.of(getString("110"))).setOutputMarkupId(true).setEnabled(i.isPasswordProtected());
    add(from.setOutputMarkupId(true), to.setOutputMarkupId(true), timeZoneId.setOutputMarkupId(true));
    timeZoneId.add(new AjaxFormComponentUpdatingBehavior("change") {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
        // no-op added to preserve selection
        }
    });
    add(url.setOutputMarkupId(true));
    add(lang, feedback);
    super.onInitialize();
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) RadioGroup(org.apache.wicket.markup.html.form.RadioGroup) Valid(org.apache.openmeetings.db.entity.room.Invitation.Valid) Invitation(org.apache.openmeetings.db.entity.room.Invitation) AjaxCheckBox(org.apache.wicket.ajax.markup.html.form.AjaxCheckBox) Radio(org.apache.wicket.markup.html.form.Radio) AjaxFormChoiceComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior)

Aggregations

Invitation (org.apache.openmeetings.db.entity.room.Invitation)1 Valid (org.apache.openmeetings.db.entity.room.Invitation.Valid)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 AjaxFormChoiceComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior)1 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)1 AjaxCheckBox (org.apache.wicket.ajax.markup.html.form.AjaxCheckBox)1 Radio (org.apache.wicket.markup.html.form.Radio)1 RadioGroup (org.apache.wicket.markup.html.form.RadioGroup)1