Search in sources :

Example 31 with AjaxLink

use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.

the class PageAccounts method initLinks.

private void initLinks(Form form, Form accForm) {
    AjaxSubmitLink listSyncDetails = new AjaxSubmitLink(ID_LIST_SYNC_DETAILS) {

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

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            target.add(getFeedbackPanel());
        }
    };
    form.add(listSyncDetails);
    AjaxSubmitLink export = new AjaxSubmitLink(ID_EXPORT) {

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

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            target.add(getFeedbackPanel());
        }
    };
    form.add(export);
    AjaxLink clearExport = new AjaxLink(ID_CLEAR_EXPORT) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            clearExportPerformed(target);
        }
    };
    accForm.add(clearExport);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Form(org.apache.wicket.markup.html.form.Form) AjaxSubmitLink(org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink)

Example 32 with AjaxLink

use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.

the class ChangePasswordPanel method initLayout.

private void initLayout(final boolean oldPasswordVisible) {
    model = (LoadableModel<MyPasswordsDto>) getModel();
    Label oldPasswordLabel = new Label(ID_OLD_PASSWORD_LABEL, createStringResource("PageSelfCredentials.oldPasswordLabel"));
    add(oldPasswordLabel);
    oldPasswordLabel.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return oldPasswordVisible;
        }
    });
    Label passwordLabel = new Label(ID_PASSWORD_LABEL, createStringResource("PageSelfCredentials.passwordLabel1"));
    add(passwordLabel);
    PasswordTextField oldPasswordField = new PasswordTextField(ID_OLD_PASSWORD_FIELD, new PropertyModel<String>(model, MyPasswordsDto.F_OLD_PASSWORD));
    oldPasswordField.setRequired(false);
    oldPasswordField.setResetPassword(false);
    add(oldPasswordField);
    oldPasswordField.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        public boolean isVisible() {
            return oldPasswordVisible;
        }

        ;
    });
    PasswordPanel passwordPanel = new PasswordPanel(ID_PASSWORD_PANEL, new PropertyModel<ProtectedStringType>(model, MyPasswordsDto.F_PASSWORD));
    passwordPanel.getBaseFormComponent().add(new AttributeModifier("autofocus", ""));
    add(passwordPanel);
    WebMarkupContainer accountContainer = new WebMarkupContainer(ID_ACCOUNTS_CONTAINER);
    List<IColumn<PasswordAccountDto, String>> columns = initColumns();
    ListDataProvider<PasswordAccountDto> provider = new ListDataProvider<PasswordAccountDto>(this, new PropertyModel<List<PasswordAccountDto>>(model, MyPasswordsDto.F_ACCOUNTS));
    TablePanel accounts = new TablePanel(ID_ACCOUNTS_TABLE, provider, columns);
    accounts.setItemsPerPage(30);
    accounts.setShowPaging(false);
    if (model.getObject().getPropagation() != null && model.getObject().getPropagation().equals(CredentialsPropagationUserControlType.MAPPING)) {
        accountContainer.setVisible(false);
    }
    accountContainer.add(accounts);
    AjaxLink help = new AjaxLink(ID_BUTTON_HELP) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            showHelpPerformed(target);
        }
    };
    accountContainer.add(help);
    add(accountContainer);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) PasswordPanel(com.evolveum.midpoint.gui.api.component.password.PasswordPanel) Label(org.apache.wicket.markup.html.basic.Label) PasswordTextField(org.apache.wicket.markup.html.form.PasswordTextField) AttributeModifier(org.apache.wicket.AttributeModifier) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) PasswordAccountDto(com.evolveum.midpoint.web.page.admin.home.dto.PasswordAccountDto) MyPasswordsDto(com.evolveum.midpoint.web.page.admin.home.dto.MyPasswordsDto) ArrayList(java.util.ArrayList) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) ProtectedStringType(com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType) TablePanel(com.evolveum.midpoint.web.component.data.TablePanel)

Example 33 with AjaxLink

use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.

the class ChooseTypePanel method initLayout.

protected void initLayout() {
    final Label name = new Label(ID_OBJECT_NAME, new AbstractReadOnlyModel<String>() {

        private static final long serialVersionUID = 1L;

        @Override
        public String getObject() {
            ObjectViewDto<T> dto = getModel().getObject();
            if (dto != null) {
                if (dto.getName() != null)
                    return getModel().getObject().getName();
                else if (ObjectViewDto.BAD_OID.equals(dto.getOid())) {
                    return createStringResource("chooseTypePanel.ObjectNameValue.badOid").getString();
                } else {
                    return createStringResource("chooseTypePanel.ObjectNameValue.null").getString();
                }
            }
            return "";
        }
    });
    name.setOutputMarkupId(true);
    AjaxLink<String> choose = new AjaxLink<String>(ID_LINK_CHOOSE) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            changeOptionPerformed(target);
        }
    };
    AjaxLink<String> remove = new AjaxLink<String>(ID_LINK_REMOVE) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            setToDefault();
            target.add(name);
        }
    };
    add(choose);
    add(remove);
    add(name);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Label(org.apache.wicket.markup.html.basic.Label) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) ObjectViewDto(com.evolveum.midpoint.web.page.admin.dto.ObjectViewDto)

Example 34 with AjaxLink

use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.

the class ObjectPolicyPanel method initButtons.

private void initButtons(WebMarkupContainer buttonGroup, final ListItem item) {
    AjaxLink add = new AjaxLink(ID_BUTTON_ADD) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            addPerformed(target);
        }
    };
    add.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return isAddButtonVisible(item);
        }
    });
    buttonGroup.add(add);
    AjaxLink remove = new AjaxLink(ID_BUTTON_REMOVE) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            removePerformed(target, item);
        }
    };
    remove.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return isRemoveButtonVisible();
        }
    });
    buttonGroup.add(remove);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink)

Example 35 with AjaxLink

use of org.apache.wicket.ajax.markup.html.AjaxLink in project midpoint by Evolveum.

the class H3Header method initLayout.

@Override
protected void initLayout() {
    Label title = new Label(ID_TITLE, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            return getDisplayName();
        }
    });
    add(title);
    final IModel<List<InlineMenuItem>> items = new Model((Serializable) createMenuItems());
    BootstrapLabel status = new BootstrapLabel(ID_STATUS, createStringResource("H3Header.label.error"), new Model(BootstrapLabel.State.DANGER));
    status.add(createFetchErrorVisibleBehaviour());
    add(status);
    AjaxLink showMore = new AjaxLink(ID_SHOW_MORE) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            onShowMorePerformed(target);
        }
    };
    showMore.add(createFetchErrorVisibleBehaviour());
    add(showMore);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) BootstrapLabel(com.evolveum.midpoint.web.component.BootstrapLabel) Label(org.apache.wicket.markup.html.basic.Label) BootstrapLabel(com.evolveum.midpoint.web.component.BootstrapLabel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) IModel(org.apache.wicket.model.IModel) ArrayList(java.util.ArrayList) List(java.util.List) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink)

Aggregations

AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)83 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)82 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)50 Label (org.apache.wicket.markup.html.basic.Label)50 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)44 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)28 ListItem (org.apache.wicket.markup.html.list.ListItem)21 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)17 ListView (org.apache.wicket.markup.html.list.ListView)17 TextField (org.apache.wicket.markup.html.form.TextField)15 ArrayList (java.util.ArrayList)13 AjaxFormComponentUpdatingBehavior (org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior)13 AttributeModifier (org.apache.wicket.AttributeModifier)12 List (java.util.List)11 Form (org.apache.wicket.markup.html.form.Form)11 AjaxSubmitLink (org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink)10 IModel (org.apache.wicket.model.IModel)9 Model (org.apache.wicket.model.Model)8 ComponentFeedbackMessageFilter (org.apache.wicket.feedback.ComponentFeedbackMessageFilter)6 FeedbackPanel (org.apache.wicket.markup.html.panel.FeedbackPanel)6