use of org.apache.wicket.markup.html.form.Form in project midpoint by Evolveum.
the class PageAssignmentShoppingKart method initLayout.
private void initLayout() {
roleManagementConfigurationType = getRoleManagementConfigurationType();
Form mainForm = new org.apache.wicket.markup.html.form.Form(ID_MAIN_FORM);
add(mainForm);
catalogOid = getRoleCatalogOid();
mainForm.add(initMainPanel());
}
use of org.apache.wicket.markup.html.form.Form in project midpoint by Evolveum.
the class PageAbstractSelfCredentials method initButtons.
private void initButtons(Form<?> mainForm) {
AjaxSubmitButton save = new AjaxSubmitButton(ID_SAVE_BUTTON, createStringResource("PageBase.button.save")) {
private static final long serialVersionUID = 1L;
@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
target.add(getFeedbackPanel());
}
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
onSavePerformed(target);
}
};
mainForm.setDefaultButton(save);
mainForm.add(save);
AjaxSubmitButton cancel = new AjaxSubmitButton(ID_CANCEL_BUTTON, createStringResource("PageBase.button.back")) {
private static final long serialVersionUID = 1L;
@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
onCancelPerformed(target);
}
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
onCancelPerformed(target);
}
};
mainForm.add(cancel);
}
use of org.apache.wicket.markup.html.form.Form in project midpoint by Evolveum.
the class PageAbstractSelfCredentials method initLayout.
private void initLayout() {
Form<?> mainForm = new Form<>(ID_MAIN_FORM);
List<ITab> tabs = new ArrayList<>();
tabs.add(new AbstractTab(createStringResource("PageSelfCredentials.tabs.password")) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer getPanel(String panelId) {
return new ChangePasswordPanel(panelId, isCheckOldPassword(), model, model.getObject());
}
});
TabbedPanel<ITab> credentialsTabPanel = WebComponentUtil.createTabPanel(ID_TAB_PANEL, this, tabs, null);
credentialsTabPanel.setOutputMarkupId(true);
mainForm.add(credentialsTabPanel);
initButtons(mainForm);
add(mainForm);
}
use of org.apache.wicket.markup.html.form.Form in project midpoint by Evolveum.
the class PageEvaluateMapping method initLayout.
private void initLayout() {
Form mainForm = new Form(ID_MAIN_FORM);
add(mainForm);
AceEditor editorMapping = new AceEditor(ID_EDITOR_MAPPING, new PropertyModel<String>(model, ExecuteMappingDto.F_MAPPING));
editorMapping.setHeight(400);
editorMapping.setResizeToMaxHeight(false);
mainForm.add(editorMapping);
AceEditor editorRequest = new AceEditor(ID_EDITOR_REQUEST, new PropertyModel<String>(model, ExecuteMappingDto.F_REQUEST));
editorRequest.setHeight(430);
editorRequest.setResizeToMaxHeight(false);
mainForm.add(editorRequest);
AjaxSubmitButton evaluateMapping = new AjaxSubmitButton(ID_EXECUTE, createStringResource("PageEvaluateMapping.button.evaluateMapping")) {
@Override
protected void onError(AjaxRequestTarget target, Form<?> form) {
target.add(getFeedbackPanel());
}
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
executeMappingPerformed(target);
}
};
mainForm.add(evaluateMapping);
final DropDownChoice<String> sampleChoice = new DropDownChoice<>(ID_MAPPING_SAMPLE, Model.of(""), new AbstractReadOnlyModel<List<String>>() {
@Override
public List<String> getObject() {
return SAMPLES;
}
}, new StringResourceChoiceRenderer("PageEvaluateMapping.sample"));
sampleChoice.setNullValid(true);
sampleChoice.add(new OnChangeAjaxBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
String sampleName = sampleChoice.getModelObject();
if (StringUtils.isEmpty(sampleName)) {
return;
}
model.getObject().setMapping(readResource(SAMPLES_DIR + "/" + sampleName + ".map.xml.data"));
model.getObject().setRequest(readResource(SAMPLES_DIR + "/" + sampleName + ".req.xml.data"));
model.getObject().setResultText("");
target.add(PageEvaluateMapping.this);
}
private String readResource(String name) {
InputStream is = PageEvaluateMapping.class.getResourceAsStream(name);
if (is != null) {
try {
return IOUtils.toString(is, "UTF-8");
} catch (IOException e) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't read sample from resource {}", e, name);
} finally {
IOUtils.closeQuietly(is);
}
} else {
LOGGER.warn("Resource {} containing sample couldn't be found", name);
}
return null;
}
});
mainForm.add(sampleChoice);
AceEditor resultText = new AceEditor(ID_RESULT_TEXT, new PropertyModel<String>(model, ExecuteMappingDto.F_RESULT_TEXT));
resultText.setReadonly(true);
resultText.setHeight(300);
resultText.setResizeToMaxHeight(false);
resultText.setMode(null);
mainForm.add(resultText);
}
use of org.apache.wicket.markup.html.form.Form in project midpoint by Evolveum.
the class PageImportObject method initLayout.
private void initLayout() {
Form mainForm = new Form(ID_MAIN_FORM);
add(mainForm);
ImportOptionsPanel importOptions = new ImportOptionsPanel(ID_IMPORT_OPTIONS, model);
mainForm.add(importOptions);
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);
}
Aggregations