Search in sources :

Example 1 with Radio

use of org.apache.wicket.markup.html.form.Radio 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)

Example 2 with Radio

use of org.apache.wicket.markup.html.form.Radio in project midpoint by Evolveum.

the class PageImportObject method initLayout.

private void initLayout() {
    Form<?> mainForm = new MidpointForm<>(ID_MAIN_FORM);
    mainForm.setMultiPart(true);
    add(mainForm);
    ImportOptionsPanel importOptions = new ImportOptionsPanel(ID_IMPORT_OPTIONS, optionsModel, fullProcessingModel);
    mainForm.add(importOptions);
    final WebMarkupContainer input = new WebMarkupContainer(ID_INPUT);
    input.setOutputMarkupId(true);
    mainForm.add(input);
    WebMarkupContainer buttonBar = new WebMarkupContainer(ID_BUTTON_BAR);
    buttonBar.setOutputMarkupId(true);
    mainForm.add(buttonBar);
    final IModel<Integer> groupModel = new Model<>(INPUT_FILE);
    RadioGroup<Integer> importRadioGroup = new RadioGroup<>(ID_IMPORT_RADIO_GROUP, groupModel);
    importRadioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(input);
            target.add(buttonBar);
        }
    });
    mainForm.add(importRadioGroup);
    Radio<Integer> fileRadio = new Radio<>(ID_FILE_RADIO, new Model<>(INPUT_FILE), importRadioGroup);
    importRadioGroup.add(fileRadio);
    Radio<Integer> xmlRadio = new Radio<>(ID_XML_RADIO, new Model<>(INPUT_XML), importRadioGroup);
    importRadioGroup.add(xmlRadio);
    WebMarkupContainer inputAce = new WebMarkupContainer(ID_INPUT_ACE);
    addVisibileForInputType(inputAce, INPUT_XML, groupModel);
    input.add(inputAce);
    dataLanguage = determineDataLanguage();
    DataLanguagePanel<List> languagePanel = new DataLanguagePanel<List>(ID_LANGUAGE_PANEL, dataLanguage, List.class, this) {

        @Override
        protected void onLanguageSwitched(AjaxRequestTarget target, int index, String updatedLanguage, String objectString) {
            dataLanguage = updatedLanguage;
            xmlEditorModel.setObject(objectString);
            addOrReplaceEditor(inputAce);
            target.add(mainForm);
        }

        @Override
        protected String getObjectStringRepresentation() {
            return xmlEditorModel.getObject();
        }
    };
    inputAce.add(languagePanel);
    addOrReplaceEditor(inputAce);
    WebMarkupContainer inputFileLabel = new WebMarkupContainer(ID_INPUT_FILE_LABEL);
    addVisibileForInputType(inputFileLabel, INPUT_FILE, groupModel);
    input.add(inputFileLabel);
    WebMarkupContainer inputFile = new WebMarkupContainer(ID_INPUT_FILE);
    addVisibileForInputType(inputFile, INPUT_FILE, groupModel);
    input.add(inputFile);
    FileUploadField fileInput = new FileUploadField(ID_FILE_INPUT);
    inputFile.add(fileInput);
    initButtons(buttonBar, groupModel);
}
Also used : RadioGroup(org.apache.wicket.markup.html.form.RadioGroup) MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) Radio(org.apache.wicket.markup.html.form.Radio) DataLanguagePanel(com.evolveum.midpoint.web.component.input.DataLanguagePanel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) FileUploadField(org.apache.wicket.markup.html.form.upload.FileUploadField) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ImportOptionsPanel(com.evolveum.midpoint.web.page.admin.configuration.component.ImportOptionsPanel) IModel(org.apache.wicket.model.IModel) Model(org.apache.wicket.model.Model) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) List(java.util.List) AjaxFormChoiceComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior)

Example 3 with Radio

use of org.apache.wicket.markup.html.form.Radio in project midpoint by Evolveum.

the class PageNewReport method initLayout.

private void initLayout() {
    Form mainForm = new Form(ID_MAIN_FORM);
    add(mainForm);
    final WebMarkupContainer input = new WebMarkupContainer(ID_INPUT);
    input.setOutputMarkupId(true);
    mainForm.add(input);
    final WebMarkupContainer buttonBar = new WebMarkupContainer(ID_BUTTON_BAR);
    buttonBar.setOutputMarkupId(true);
    mainForm.add(buttonBar);
    final IModel<Integer> groupModel = new Model<Integer>(INPUT_FILE);
    RadioGroup importRadioGroup = new RadioGroup(ID_IMPORT_RADIO_GROUP, groupModel);
    importRadioGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(input);
            target.add(buttonBar);
        }
    });
    mainForm.add(importRadioGroup);
    Radio fileRadio = new Radio(ID_FILE_RADIO, new Model(INPUT_FILE), importRadioGroup);
    importRadioGroup.add(fileRadio);
    Radio xmlRadio = new Radio(ID_XML_RADIO, new Model(INPUT_XML), importRadioGroup);
    importRadioGroup.add(xmlRadio);
    WebMarkupContainer inputAce = new WebMarkupContainer(ID_INPUT_ACE);
    addVisibileForInputType(inputAce, INPUT_XML, groupModel);
    input.add(inputAce);
    AceEditor aceEditor = new AceEditor(ID_ACE_EDITOR, xmlEditorModel);
    aceEditor.setOutputMarkupId(true);
    inputAce.add(aceEditor);
    WebMarkupContainer inputFileLabel = new WebMarkupContainer(ID_INPUT_FILE_LABEL);
    addVisibileForInputType(inputFileLabel, INPUT_FILE, groupModel);
    input.add(inputFileLabel);
    WebMarkupContainer inputFile = new WebMarkupContainer(ID_INPUT_FILE);
    addVisibileForInputType(inputFile, INPUT_FILE, groupModel);
    input.add(inputFile);
    FileUploadField fileInput = new FileUploadField(ID_FILE_INPUT);
    inputFile.add(fileInput);
    initButtons(buttonBar, groupModel);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) RadioGroup(org.apache.wicket.markup.html.form.RadioGroup) Form(org.apache.wicket.markup.html.form.Form) IModel(org.apache.wicket.model.IModel) Model(org.apache.wicket.model.Model) Radio(org.apache.wicket.markup.html.form.Radio) AceEditor(com.evolveum.midpoint.web.component.AceEditor) AjaxFormChoiceComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) FileUploadField(org.apache.wicket.markup.html.form.upload.FileUploadField)

Aggregations

AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)3 AjaxFormChoiceComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior)3 Radio (org.apache.wicket.markup.html.form.Radio)3 RadioGroup (org.apache.wicket.markup.html.form.RadioGroup)3 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)2 FileUploadField (org.apache.wicket.markup.html.form.upload.FileUploadField)2 IModel (org.apache.wicket.model.IModel)2 Model (org.apache.wicket.model.Model)2 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 AceEditor (com.evolveum.midpoint.web.component.AceEditor)1 MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)1 DataLanguagePanel (com.evolveum.midpoint.web.component.input.DataLanguagePanel)1 ImportOptionsPanel (com.evolveum.midpoint.web.page.admin.configuration.component.ImportOptionsPanel)1 List (java.util.List)1 Invitation (org.apache.openmeetings.db.entity.room.Invitation)1 Valid (org.apache.openmeetings.db.entity.room.Invitation.Valid)1 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)1 AjaxCheckBox (org.apache.wicket.ajax.markup.html.form.AjaxCheckBox)1 Form (org.apache.wicket.markup.html.form.Form)1