Search in sources :

Example 1 with ImportOptionsPanel

use of com.evolveum.midpoint.web.page.admin.configuration.component.ImportOptionsPanel 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)

Aggregations

LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)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 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 AjaxFormChoiceComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior)1 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)1 Radio (org.apache.wicket.markup.html.form.Radio)1 RadioGroup (org.apache.wicket.markup.html.form.RadioGroup)1 FileUploadField (org.apache.wicket.markup.html.form.upload.FileUploadField)1 IModel (org.apache.wicket.model.IModel)1 Model (org.apache.wicket.model.Model)1