Skip to content

Commit

Permalink
refactoring of ajaxbutton behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Aug 26, 2021
1 parent 7895b42 commit ddab3a8
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -773,11 +773,6 @@ private void initCartButton(WebMarkupContainer mainHeader) {
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) {
navigateToNext(new PageAssignmentsList(true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,6 @@ public void onClick(AjaxRequestTarget target) {
addExpressionPerformed(target, expressionType);
}

@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
attributes.setEventPropagation(AjaxRequestAttributes.EventPropagation.BUBBLE);
}
};
add(select);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
package com.evolveum.midpoint.web.component;

import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.ajax.AjaxChannel;
import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.MarkupStream;
Expand Down Expand Up @@ -45,4 +47,12 @@ protected void onComponentTag(ComponentTag tag) {
tag.setType(XmlTag.TagType.OPEN);
}
}

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

}
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,6 @@ public boolean isVisible() {
.createStringResource("PageAssignmentDetails.addToCartButton")) {
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 target) {
AssignmentEditorDto dto = AssignmentEditorDto.createDtoFromObject(getObject().asObjectable(), UserDtoStatus.ADD, parentPage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,6 @@ private void initButtonsPanel(WebMarkupContainer parametersPanel) {
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
AbstractShoppingCartTabPanel.this.addAllAssignmentsPerformed(ajaxRequestTarget);
}

@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
attributes.setEventPropagation(AjaxRequestAttributes.EventPropagation.BUBBLE);
}
};
addAllButton.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
Expand All @@ -327,11 +321,6 @@ public boolean isEnabled() {
AjaxButton goToShoppingCartButton = new AjaxButton(ID_GO_TO_SHOPPING_CART_BUTTON, createStringResource("AbstractShoppingCartTabPanel.goToShoppingCartButton")) {
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) {
AbstractShoppingCartTabPanel.this.getPageBase().navigateToNext(new PageAssignmentsList(true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,6 @@ public void onClick(AjaxRequestTarget target) {
}
}

@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
attributes.setEventPropagation(AjaxRequestAttributes.EventPropagation.BUBBLE);
}

};
requestAssignments.add(new VisibleEnableBehaviour() {
@Override
Expand Down

0 comments on commit ddab3a8

Please sign in to comment.