Skip to content

Commit

Permalink
fixing MID-3157
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Jun 16, 2017
1 parent 456b8e7 commit 121a084
Showing 1 changed file with 17 additions and 4 deletions.
Expand Up @@ -21,6 +21,8 @@
import com.evolveum.midpoint.web.component.data.column.DoubleButtonColumn;

import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
import org.apache.wicket.behavior.AttributeAppender;
Expand Down Expand Up @@ -60,7 +62,9 @@ protected void initLayout() {
for (int id = 0; id < numberOfButtons; id++) {
final int finalId = getButtonId(id);
AjaxButton button = new AjaxButton(String.valueOf(finalId), createStringResource(getCaption(finalId))) {
@Override

private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
clickPerformed(finalId, target, MultiButtonPanel.this.getModel());
}
Expand All @@ -69,16 +73,25 @@ protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
attributes.setEventPropagation(AjaxRequestAttributes.EventPropagation.BUBBLE);
}
@Override

};

button.add(new VisibleEnableBehaviour() {

private static final long serialVersionUID = 1L;
@Override
public boolean isEnabled(){
return MultiButtonPanel.this.isButtonEnabled(finalId, MultiButtonPanel.this.getModel());
}
@Override
public boolean isVisible(){
return MultiButtonPanel.this.isButtonVisible(finalId, MultiButtonPanel.this.getModel());
}
};
button.add(new AttributeAppender("class", getButtonCssClass(finalId)));
});
button.add(AttributeAppender.append("class", getButtonCssClass(finalId)));
if (!isButtonEnabled(finalId, getModel())) {
button.add(AttributeAppender.append("class", "disabled"));
}
button.add(new AttributeAppender("title", getButtonTitle(finalId)));
buttons.add(button);
buttons.add(new Label("label"+finalId, " "));
Expand Down

0 comments on commit 121a084

Please sign in to comment.