Search in sources :

Example 36 with AjaxRequestTarget

use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.

the class PageSelfRegistration method initLayout.

private void initLayout() {
    final Form<?> mainForm = new Form<>(ID_MAIN_FORM);
    initAccessBehaviour(mainForm);
    add(mainForm);
    addMultilineLable(ID_WELCOME, "PageSelfRegistration.welcome.message", mainForm);
    addMultilineLable(ID_ADDITIONAL_TEXT, "PageSelfRegistration.additional.message", mainForm);
    initStaticFormLayout(mainForm);
    initDynamicFormLayout(mainForm);
    CaptchaPanel captcha = new CaptchaPanel(ID_CAPTCHA);
    captcha.setOutputMarkupId(true);
    mainForm.add(captcha);
    AjaxSubmitButton register = new AjaxSubmitButton(ID_SUBMIT_REGISTRATION) {

        private static final long serialVersionUID = 1L;

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

        protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
            submitRegistration(target);
        }
    };
    mainForm.add(register);
    MultiLineLabel label = new MultiLineLabel(ID_REGISTRATION_SUBMITED, createStringResource("PageSelfRegistration.registration.confirm.message"));
    add(label);
    label.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return submited;
        }

        @Override
        public boolean isEnabled() {
            return submited;
        }
    });
    AjaxButton back = new AjaxButton(ID_BACK) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            setResponsePage(PageLogin.class);
        }
    };
    mainForm.add(back);
}
Also used : AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) Form(com.evolveum.midpoint.web.component.form.Form) CaptchaPanel(com.evolveum.midpoint.gui.api.component.captcha.CaptchaPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) MultiLineLabel(org.apache.wicket.markup.html.basic.MultiLineLabel)

Example 37 with AjaxRequestTarget

use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.

the class OrgUnitAddDeletePopup method initLayout.

public void initLayout(WebMarkupContainer content) {
    List<IColumn<SelectableBean<ObjectType>, String>> columns = initColumns();
    ObjectDataProvider provider = new ObjectDataProvider(getPageBase(), OrgType.class);
    provider.setQuery(getDataProviderQuery());
    TablePanel table = new TablePanel<SelectableBean<ObjectType>>(ID_TABLE, provider, columns);
    table.setOutputMarkupId(true);
    content.add(table);
    AjaxButton cancelButton = new AjaxButton(ID_BUTTON_CANCEL, createStringResource("orgUnitAddDeletePopup.button.cancel")) {

        @Override
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {
            cancelPerformed(ajaxRequestTarget);
        }
    };
    content.add(cancelButton);
    AjaxButton actionButton = new AjaxButton(ID_BUTTON_ACTION, createActionButtonStringResource()) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            actionPerformed(target);
        }
    };
    actionButton.add(new AttributeAppender("class", getActionButtonClass()));
    content.add(actionButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) ObjectDataProvider(com.evolveum.midpoint.web.component.data.ObjectDataProvider) AttributeAppender(org.apache.wicket.behavior.AttributeAppender) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 38 with AjaxRequestTarget

use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.

the class TreeTablePanel method initLayout.

protected void initLayout() {
    OrgTreePanel treePanel = new OrgTreePanel(ID_TREE_PANEL, getModel(), false) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void selectTreeItemPerformed(SelectableBean<OrgType> selected, AjaxRequestTarget target) {
            TreeTablePanel.this.selectTreeItemPerformed(selected, target);
        }

        protected List<InlineMenuItem> createTreeMenu() {
            return TreeTablePanel.this.createTreeMenu();
        }

        @Override
        protected List<InlineMenuItem> createTreeChildrenMenu(OrgType org) {
            return TreeTablePanel.this.createTreeChildrenMenu(org);
        }
    };
    treePanel.setOutputMarkupId(true);
    add(treePanel);
    add(createMemberPanel(treePanel.getSelected().getValue()));
    setOutputMarkupId(true);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) OrgTreePanel(com.evolveum.midpoint.web.page.admin.orgs.OrgTreePanel) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)

Example 39 with AjaxRequestTarget

use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.

the class PageWorkItems method initItemButtons.

private void initItemButtons(Form mainForm) {
    AjaxButton claim = new AjaxButton("claim", createStringResource("pageWorkItems.button.claim")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            claimWorkItemsPerformed(target);
        }
    };
    claim.setVisible(!all && claimable);
    mainForm.add(claim);
    AjaxButton release = new AjaxButton("release", createStringResource("pageWorkItems.button.release")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            releaseWorkItemsPerformed(target);
        }
    };
    release.setVisible(!all && !claimable);
    mainForm.add(release);
    // the following are shown irrespectively of whether the work item is assigned or not
    AjaxButton approve = new AjaxButton("approve", createStringResource("pageWorkItems.button.approve")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            approveOrRejectWorkItemsPerformed(target, true);
        }
    };
    mainForm.add(approve);
    AjaxButton reject = new AjaxButton("reject", createStringResource("pageWorkItems.button.reject")) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            approveOrRejectWorkItemsPerformed(target, false);
        }
    };
    mainForm.add(reject);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxButton(com.evolveum.midpoint.web.component.AjaxButton)

Example 40 with AjaxRequestTarget

use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.

the class AbstractObjectMainPanel method initLayoutPreviewButton.

// TEMPORARY
protected void initLayoutPreviewButton(final PageAdminObjectDetails<O> parentPage) {
    AjaxSubmitButton previewButton = new AjaxSubmitButton(ID_PREVIEW_CHANGES, parentPage.createStringResource("pageAdminFocus.button.previewChanges")) {

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

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

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return AbstractObjectMainPanel.this.isPreviewButtonVisible();
        }

        @Override
        public boolean isEnabled() {
            PrismContainerDefinition def = getObjectWrapper().getDefinition();
            if (ContainerStatus.MODIFYING.equals(getObjectWrapper().getStatus()) && !def.canModify()) {
                return areSavePreviewButtonsEnabled();
            }
            return true;
        }
    });
    mainForm.add(previewButton);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) Form(com.evolveum.midpoint.web.component.form.Form) PrismContainerDefinition(com.evolveum.midpoint.prism.PrismContainerDefinition) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Aggregations

AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)393 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)116 Label (org.apache.wicket.markup.html.basic.Label)108 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)105 ArrayList (java.util.ArrayList)91 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)82 Form (org.apache.wicket.markup.html.form.Form)78 IModel (org.apache.wicket.model.IModel)73 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)71 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)65 List (java.util.List)56 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)48 ListItem (org.apache.wicket.markup.html.list.ListItem)43 Model (org.apache.wicket.model.Model)43 PropertyModel (org.apache.wicket.model.PropertyModel)42 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)37 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)34 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)34 ListView (org.apache.wicket.markup.html.list.ListView)32 TextField (org.apache.wicket.markup.html.form.TextField)30