Search in sources :

Example 11 with Form

use of com.evolveum.midpoint.web.component.form.Form in project midpoint by Evolveum.

the class PageAssignmentDetails method initLayout.

public void initLayout(final IModel<AssignmentEditorDto> assignmentModel) {
    setOutputMarkupId(true);
    Form mainForm = new Form(ID_FORM);
    mainForm.setOutputMarkupId(true);
    add(mainForm);
    AssignmentDetailsPanel detailsPanel = new AssignmentDetailsPanel(ID_DETAILS_PANEL, assignmentModel, PageAssignmentDetails.this);
    detailsPanel.setOutputMarkupId(true);
    mainForm.add(detailsPanel);
    AjaxButton back = new AjaxButton(ID_BACK, createStringResource("PageAssignmentDetails.backButton")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            redirectBack();
        }
    };
    mainForm.add(back);
    AjaxButton addToCart = new AjaxButton(ID_ADD_TO_CART, createStringResource("PageAssignmentDetails.addToCartButton")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            RoleCatalogStorage storage = getSessionStorage().getRoleCatalog();
            if (storage.getAssignmentShoppingCart() == null) {
                storage.setAssignmentShoppingCart(new ArrayList<AssignmentEditorDto>());
            }
            AssignmentEditorDto dto = assignmentModel.getObject();
            dto.setMinimized(true);
            dto.setSimpleView(false);
            storage.getAssignmentShoppingCart().add(dto);
            redirectBack();
        }
    };
    mainForm.add(addToCart);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) AssignmentEditorDto(com.evolveum.midpoint.web.component.assignment.AssignmentEditorDto) Form(com.evolveum.midpoint.web.component.form.Form) RoleCatalogStorage(com.evolveum.midpoint.web.session.RoleCatalogStorage) AssignmentDetailsPanel(com.evolveum.midpoint.web.component.assignment.AssignmentDetailsPanel)

Example 12 with Form

use of com.evolveum.midpoint.web.component.form.Form in project midpoint by Evolveum.

the class PageSystemConfiguration method initButtons.

private void initButtons(Form mainForm) {
    AjaxSubmitButton save = new AjaxSubmitButton(ID_SAVE, createStringResource("PageBase.button.save")) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
            savePerformed(target);
        }

        @Override
        protected void onError(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form form) {
            target.add(getFeedbackPanel());
        }
    };
    mainForm.add(save);
    AjaxButton cancel = new AjaxButton(ID_CANCEL, createStringResource("PageBase.button.cancel")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            cancelPerformed(target);
        }
    };
    mainForm.add(cancel);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) Form(com.evolveum.midpoint.web.component.form.Form)

Example 13 with Form

use of com.evolveum.midpoint.web.component.form.Form in project midpoint by Evolveum.

the class MergeObjectsPanel method initLayout.

private void initLayout() {
    Form mainForm = new Form(ID_FORM);
    mainForm.setOutputMarkupId(true);
    add(mainForm);
    DropDownChoicePanel mergeTypeSelect = new DropDownChoicePanel(ID_MERGE_TYPE_SELECTOR, mergeTypeModel, mergeTypeChoicesModel);
    mergeTypeSelect.getBaseFormComponent().add(new OnChangeAjaxBehavior() {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            mergeResultObject = getMergeObjectsResult();
            WebMarkupContainer resultObjectPanel = (WebMarkupContainer) get(ID_FORM).get(ID_OBJECTS_PANEL).get(ID_MERGE_RESULT_PANEL_CONTAINER);
            resultObjectPanel.addOrReplace(getMergeResultObjectPanel());
            target.add(resultObjectPanel);
        }
    });
    mergeTypeSelect.setOutputMarkupId(true);
    mainForm.add(mergeTypeSelect);
    final WebMarkupContainer objectsPanel = new WebMarkupContainer(ID_OBJECTS_PANEL);
    objectsPanel.setOutputMarkupId(true);
    mainForm.addOrReplace(objectsPanel);
    initObjectsPanel(objectsPanel);
    AjaxButton switchDirectionButton = new AjaxButton(ID_SWITCH_DIRECTION_BUTTON, pageBase.createStringResource("MergeObjectsPanel.switchDirection")) {

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            F temp = mergeObjectModel.getObject();
            mergeObjectModel.setObject(mergeWithObjectModel.getObject());
            mergeWithObjectModel.setObject(temp);
            initObjectsPanel(objectsPanel);
            ajaxRequestTarget.add(objectsPanel);
        }
    };
    switchDirectionButton.setOutputMarkupId(true);
    mainForm.add(switchDirectionButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) DropDownChoicePanel(com.evolveum.midpoint.web.component.input.DropDownChoicePanel) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) Form(com.evolveum.midpoint.web.component.form.Form) OnChangeAjaxBehavior(org.apache.wicket.ajax.form.OnChangeAjaxBehavior) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 14 with Form

use of com.evolveum.midpoint.web.component.form.Form in project midpoint by Evolveum.

the class PageResourceVisualization method initLayout.

private void initLayout() {
    Form form = new Form(ID_FORM);
    add(form);
    WebMarkupContainer dotContainer = new WebMarkupContainer(ID_DOT_CONTAINER);
    dotContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return visualizationModel.getObject().getSvg() == null;
        }
    });
    form.add(dotContainer);
    TextArea<String> dot = new TextArea<>(ID_DOT, new PropertyModel<String>(visualizationModel, ResourceVisualizationDto.F_DOT));
    dotContainer.add(dot);
    Label error = new Label(ID_ERROR, new PropertyModel<String>(visualizationModel, ResourceVisualizationDto.F_EXCEPTION_AS_STRING));
    dotContainer.add(error);
    Label svg = new Label(ID_SVG, new PropertyModel<String>(visualizationModel, ResourceVisualizationDto.F_SVG));
    svg.setEscapeModelStrings(false);
    svg.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return visualizationModel.getObject().getSvg() != null;
        }
    });
    form.add(svg);
    AjaxSubmitButton back = new AjaxSubmitButton(ID_BACK) {

        @Override
        public void onSubmit(AjaxRequestTarget ajaxRequestTarget, org.apache.wicket.markup.html.form.Form<?> form) {
            redirectBack();
        }

        @Override
        protected void onError(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
            target.add(getFeedbackPanel());
        }
    };
    form.add(back);
}
Also used : AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) Form(com.evolveum.midpoint.web.component.form.Form) TextArea(org.apache.wicket.markup.html.form.TextArea) Label(org.apache.wicket.markup.html.basic.Label) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 15 with Form

use of com.evolveum.midpoint.web.component.form.Form in project midpoint by Evolveum.

the class PageSystemConfiguration method initLayout.

private void initLayout() {
    Form mainForm = new Form(ID_MAIN_FORM, true);
    add(mainForm);
    List<ITab> tabs = new ArrayList<>();
    tabs.add(new AbstractTab(createStringResource("pageSystemConfiguration.system.title")) {

        @Override
        public WebMarkupContainer getPanel(String panelId) {
            systemConfigPanel = new SystemConfigPanel(panelId, model);
            return systemConfigPanel;
        }
    });
    tabs.add(new AbstractTab(createStringResource("pageSystemConfiguration.notifications.title")) {

        @Override
        public WebMarkupContainer getPanel(String panelId) {
            notificationConfigPanel = new NotificationConfigPanel(panelId, new PropertyModel<NotificationConfigurationDto>(model, "notificationConfig"));
            return notificationConfigPanel;
        }
    });
    tabs.add(new AbstractTab(createStringResource("pageSystemConfiguration.logging.title")) {

        @Override
        public WebMarkupContainer getPanel(String panelId) {
            loggingConfigPanel = new LoggingConfigPanel(panelId, new PropertyModel<LoggingDto>(model, "loggingConfig"));
            return loggingConfigPanel;
        }
    });
    tabs.add(new AbstractTab(createStringResource("pageSystemConfiguration.profiling.title")) {

        @Override
        public WebMarkupContainer getPanel(String panelId) {
            profilingConfigPanel = new ProfilingConfigPanel(panelId, new PropertyModel<ProfilingDto>(model, "profilingDto"), PageSystemConfiguration.this);
            return profilingConfigPanel;
        }
    });
    tabs.add(new AbstractTab(createStringResource("pageSystemConfiguration.adminGui.title")) {

        @Override
        public WebMarkupContainer getPanel(String panelId) {
            adminGuiConfigPanel = new AdminGuiConfigPanel(panelId, model);
            return adminGuiConfigPanel;
        }
    });
    TabbedPanel tabPanel = new TabbedPanel(ID_TAB_PANEL, tabs) {

        @Override
        protected void onTabChange(int index) {
            PageParameters params = getPageParameters();
            params.set(SELECTED_TAB_INDEX, index);
        }
    };
    tabPanel.setOutputMarkupId(true);
    mainForm.add(tabPanel);
    initButtons(mainForm);
}
Also used : Form(com.evolveum.midpoint.web.component.form.Form) ArrayList(java.util.ArrayList) TabbedPanel(com.evolveum.midpoint.web.component.TabbedPanel) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AbstractTab(org.apache.wicket.extensions.markup.html.tabs.AbstractTab)

Aggregations

Form (com.evolveum.midpoint.web.component.form.Form)16 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)12 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)9 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)7 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)6 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)5 CaptchaPanel (com.evolveum.midpoint.gui.api.component.captcha.CaptchaPanel)2 PrismContainerDefinition (com.evolveum.midpoint.prism.PrismContainerDefinition)2 ArrayList (java.util.ArrayList)2 TextArea (org.apache.wicket.markup.html.form.TextArea)2 CountableLoadableModel (com.evolveum.midpoint.gui.api.model.CountableLoadableModel)1 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 PageBase (com.evolveum.midpoint.gui.api.page.PageBase)1 SystemException (com.evolveum.midpoint.util.exception.SystemException)1 TabbedPanel (com.evolveum.midpoint.web.component.TabbedPanel)1 AssignmentDetailsPanel (com.evolveum.midpoint.web.component.assignment.AssignmentDetailsPanel)1 AssignmentEditorDto (com.evolveum.midpoint.web.component.assignment.AssignmentEditorDto)1 AssignmentTablePanel (com.evolveum.midpoint.web.component.assignment.AssignmentTablePanel)1 TargetUserSelectorComponent (com.evolveum.midpoint.web.component.assignment.TargetUserSelectorComponent)1 DropDownChoicePanel (com.evolveum.midpoint.web.component.input.DropDownChoicePanel)1