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);
}
Aggregations