Search in sources :

Example 41 with Form

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());
}
Also used : Form(org.apache.wicket.markup.html.form.Form)

Example 42 with Form

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);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) Form(org.apache.wicket.markup.html.form.Form)

Example 43 with Form

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);
}
Also used : Form(org.apache.wicket.markup.html.form.Form) ChangePasswordPanel(com.evolveum.midpoint.web.page.self.component.ChangePasswordPanel) ArrayList(java.util.ArrayList) AbstractTab(org.apache.wicket.extensions.markup.html.tabs.AbstractTab) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 44 with Form

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);
}
Also used : AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) StringResourceChoiceRenderer(com.evolveum.midpoint.web.util.StringResourceChoiceRenderer) Form(org.apache.wicket.markup.html.form.Form) InputStream(java.io.InputStream) AceEditor(com.evolveum.midpoint.web.component.AceEditor) IOException(java.io.IOException) OnChangeAjaxBehavior(org.apache.wicket.ajax.form.OnChangeAjaxBehavior) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) List(java.util.List)

Example 45 with Form

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);
}
Also used : RadioGroup(org.apache.wicket.markup.html.form.RadioGroup) Form(org.apache.wicket.markup.html.form.Form) Radio(org.apache.wicket.markup.html.form.Radio) AceEditor(com.evolveum.midpoint.web.component.AceEditor) 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) AjaxFormChoiceComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior)

Aggregations

Form (org.apache.wicket.markup.html.form.Form)109 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)78 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)37 ArrayList (java.util.ArrayList)26 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)25 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)21 Label (org.apache.wicket.markup.html.basic.Label)18 List (java.util.List)16 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)13 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)11 TextField (org.apache.wicket.markup.html.form.TextField)11 DropDownChoice (org.apache.wicket.markup.html.form.DropDownChoice)10 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)9 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)9 IModel (org.apache.wicket.model.IModel)9 PropertyModel (org.apache.wicket.model.PropertyModel)9 AceEditor (com.evolveum.midpoint.web.component.AceEditor)8 AjaxSubmitLink (org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink)8 ListItem (org.apache.wicket.markup.html.list.ListItem)8 ListView (org.apache.wicket.markup.html.list.ListView)8