Search in sources :

Example 26 with AjaxButton

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

the class TestConnectionResultPanel method initLayout.

private void initLayout(Page parentPage) {
    WebMarkupContainer contentPanel = new WebMarkupContainer(ID_CONTENT_PANEL);
    contentPanel.setOutputMarkupId(true);
    add(contentPanel);
    Label messageLabel = new Label(ID_MESSAGE, ((PageBase) parentPage).createStringResource("TestConnectionResultPanel.message"));
    messageLabel.setOutputMarkupId(true);
    contentPanel.add(messageLabel);
    messageLabel.add(new VisibleEnableBehaviour() {

        public boolean isVisible() {
            return !isLoaded;
        }
    });
    AjaxLazyLoadPanel resultsPanel = new AjaxLazyLoadPanel(ID_RESULT) {

        @Override
        public Component getLazyLoadComponent(String id) {
            return new TestConnectionMessagesPanel(id, resourceOid, (PageBase) parentPage);
        }

        @Override
        protected void onComponentLoaded(Component component, AjaxRequestTarget target) {
            isLoaded = true;
            target.add(component);
            target.add(messageLabel);
        }
    };
    contentPanel.add(resultsPanel);
    AjaxButton ok = new AjaxButton(ID_OK) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            getPageBase().hideMainPopup(target);
            okPerformed(target);
        }
    };
    contentPanel.add(ok);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) Label(org.apache.wicket.markup.html.basic.Label) AjaxLazyLoadPanel(org.apache.wicket.extensions.ajax.markup.html.AjaxLazyLoadPanel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) Component(org.apache.wicket.Component) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer)

Example 27 with AjaxButton

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

the class PageAccount method initButtons.

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

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            savePerformed(target);
        }

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            target.add(getFeedbackPanel());
        }
    };
    save.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            ObjectWrapper wrapper = accountModel.getObject();
            return !wrapper.isProtectedAccount();
        }
    });
    mainForm.add(save);
    AjaxButton back = new AjaxButton("back", createStringResource("pageAccount.button.back")) {

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

Example 28 with AjaxButton

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

the class AssignmentCatalogPanel method initCartButton.

private void initCartButton(WebMarkupContainer headerPanel) {
    AjaxButton cartButton = new AjaxButton(ID_CART_BUTTON) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
            attributes.setChannel(new AjaxChannel("blocking", AjaxChannel.Type.ACTIVE));
        }

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            pageBase.navigateToNext(PageAssignmentsList.class);
        }
    };
    cartButton.add(new VisibleEnableBehaviour() {

        public boolean isVisible() {
            return !isCatalogOidEmpty();
        }
    });
    cartButton.setOutputMarkupId(true);
    headerPanel.add(cartButton);
    Label cartItemsCount = new Label(ID_CART_ITEMS_COUNT, new LoadableModel<String>(true) {

        private static final long serialVersionUID = 1L;

        @Override
        public String load() {
            return Integer.toString(getRoleCatalogStorage().getAssignmentShoppingCart().size());
        }
    });
    cartItemsCount.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            SessionStorage storage = pageBase.getSessionStorage();
            if (storage.getRoleCatalog().getAssignmentShoppingCart().size() == 0) {
                return false;
            } else {
                return true;
            }
        }
    });
    cartItemsCount.setOutputMarkupId(true);
    cartButton.add(cartItemsCount);
}
Also used : AjaxRequestAttributes(org.apache.wicket.ajax.attributes.AjaxRequestAttributes) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) Label(org.apache.wicket.markup.html.basic.Label) AjaxChannel(org.apache.wicket.ajax.AjaxChannel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) SessionStorage(com.evolveum.midpoint.web.session.SessionStorage)

Example 29 with AjaxButton

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

the class PageCertCampaign method initButtons.

private void initButtons(final Form mainForm) {
    AjaxButton backButton = new AjaxButton(ID_BACK_BUTTON, createStringResource("PageCertCampaign.button.back")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            redirectBack();
        }
    };
    mainForm.add(backButton);
    AjaxSubmitButton startCampaignButton = new AjaxSubmitButton(ID_START_CAMPAIGN_BUTTON, createStringResource("PageCertCampaign.button.startCampaign")) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            executeCampaignStateOperation(target, OP_OPEN_NEXT_STAGE);
        }
    };
    startCampaignButton.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return campaignModel.getObject().getState() == AccessCertificationCampaignStateType.CREATED;
        }
    });
    mainForm.add(startCampaignButton);
    AjaxButton nextStageButton = new AjaxButton(ID_OPEN_NEXT_STAGE_BUTTON, createStringResource("PageCertCampaign.button.openNextStage")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            executeCampaignStateOperation(target, OP_OPEN_NEXT_STAGE);
        }
    };
    nextStageButton.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return campaignModel.getObject().getState() == AccessCertificationCampaignStateType.REVIEW_STAGE_DONE && campaignModel.getObject().getCurrentStageNumber() < campaignModel.getObject().getNumberOfStages();
        }
    });
    mainForm.add(nextStageButton);
    AjaxButton closeStageButton = new AjaxButton(ID_CLOSE_STAGE_BUTTON, createStringResource("PageCertCampaign.button.closeStage")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            executeCampaignStateOperation(target, OP_CLOSE_STAGE);
        }
    };
    closeStageButton.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return campaignModel.getObject().getState() == AccessCertificationCampaignStateType.IN_REVIEW_STAGE;
        }
    });
    mainForm.add(closeStageButton);
    AjaxButton startRemediationButton = new AjaxButton(ID_START_REMEDIATION_BUTTON, createStringResource("PageCertCampaign.button.startRemediation")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            executeCampaignStateOperation(target, OP_START_REMEDIATION);
        }
    };
    startRemediationButton.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return campaignModel.getObject().getState() == AccessCertificationCampaignStateType.REVIEW_STAGE_DONE && campaignModel.getObject().getCurrentStageNumber() == campaignModel.getObject().getNumberOfStages();
        }
    });
    mainForm.add(startRemediationButton);
// TODO reenable when confirmation window is implemented
//		AjaxButton closeCampaignButton = new AjaxButton(ID_CLOSE_CAMPAIGN_BUTTON,
//				createStringResource("PageCertCampaign.button.closeCampaign")) {
//
//			@Override
//			public void onClick(AjaxRequestTarget target) {
//				executeCampaignStateOperation(target, OP_CLOSE_CAMPAIGN);
//			}
//		};
//		closeCampaignButton.add(new VisibleEnableBehaviour() {
//			@Override
//			public boolean isVisible() {
//				return campaignModel.getObject().getState() != AccessCertificationCampaignStateType.CLOSED;
//			}
//		});
//		mainForm.add(closeCampaignButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) Form(org.apache.wicket.markup.html.form.Form) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 30 with AjaxButton

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

the class PageAssignmentsList method initLayout.

public void initLayout() {
    setOutputMarkupId(true);
    Form mainForm = new Form(ID_FORM);
    mainForm.setOutputMarkupId(true);
    add(mainForm);
    AssignmentTablePanel panel = new AssignmentTablePanel<UserType>(ID_ASSIGNMENT_TABLE_PANEL, createStringResource("FocusType.assignment"), assignmentsModel, PageAssignmentsList.this) {

        @Override
        protected List<InlineMenuItem> createAssignmentMenu() {
            List<InlineMenuItem> items = new ArrayList<>();
            InlineMenuItem item = new InlineMenuItem(createStringResource("AssignmentTablePanel.menu.unassign"), new InlineMenuItemAction() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onClick(AjaxRequestTarget target) {
                    deleteAssignmentPerformed(target);
                }
            });
            items.add(item);
            return items;
        }
    };
    mainForm.add(panel);
    WebMarkupContainer targetUserPanel = new TargetUserSelectorComponent(ID_TARGET_USER_PANEL, PageAssignmentsList.this);
    targetUserPanel.setOutputMarkupId(true);
    mainForm.add(targetUserPanel);
    TextArea descriptionInput = new TextArea<String>(ID_DESCRIPTION, descriptionModel);
    descriptionInput.add(new AjaxFormComponentUpdatingBehavior("blur") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            getSessionStorage().getRoleCatalog().setRequestDescription(getDescriptionComponent().getValue());
        }
    });
    mainForm.add(descriptionInput);
    AjaxButton back = new AjaxButton(ID_BACK, createStringResource("PageAssignmentDetails.backButton")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            redirectBack();
        }
    };
    mainForm.add(back);
    AjaxSubmitButton requestAssignments = new AjaxSubmitButton(ID_REQUEST_BUTTON, createStringResource("PageAssignmentsList.requestButton")) {

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

        @Override
        protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
            if (getSessionStorage().getRoleCatalog().getTargetUserList() == null || getSessionStorage().getRoleCatalog().getTargetUserList().size() <= 1) {
                onSingleUserRequestPerformed(target);
            } else {
                onMultiUserRequestPerformed(target);
            }
        }
    };
    requestAssignments.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return getSessionStorage().getRoleCatalog().isMultiUserRequest() || areConflictsResolved();
        }
    });
    mainForm.add(requestAssignments);
    AjaxSubmitButton resolveAssignments = new AjaxSubmitButton(ID_RESOLVE_CONFLICTS_BUTTON, createStringResource("PageAssignmentsList.resolveConflicts")) {

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

        @Override
        protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
            PageAssignmentsList.this.navigateToNext(PageAssignmentConflicts.class);
        }
    };
    resolveAssignments.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !getSessionStorage().getRoleCatalog().isMultiUserRequest() && getSessionStorage().getRoleCatalog().getConflictsList() != null && getSessionStorage().getRoleCatalog().getConflictsList().size() > 0;
        }
    });
    mainForm.add(resolveAssignments);
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) Form(com.evolveum.midpoint.web.component.form.Form) TextArea(org.apache.wicket.markup.html.form.TextArea) TargetUserSelectorComponent(com.evolveum.midpoint.web.component.assignment.TargetUserSelectorComponent) AssignmentTablePanel(com.evolveum.midpoint.web.component.assignment.AssignmentTablePanel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Aggregations

AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)67 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)65 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)26 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)20 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)18 Form (org.apache.wicket.markup.html.form.Form)13 Label (org.apache.wicket.markup.html.basic.Label)12 ArrayList (java.util.ArrayList)11 List (java.util.List)10 TablePanel (com.evolveum.midpoint.web.component.data.TablePanel)7 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)7 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)7 Form (com.evolveum.midpoint.web.component.form.Form)6 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)6 AjaxRequestAttributes (org.apache.wicket.ajax.attributes.AjaxRequestAttributes)4 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)4 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)4 DropDownChoice (org.apache.wicket.markup.html.form.DropDownChoice)4 TextArea (org.apache.wicket.markup.html.form.TextArea)4 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)3