Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Apr 10, 2019
2 parents 67d9f06 + d319402 commit f4c5595
Show file tree
Hide file tree
Showing 33 changed files with 1,355 additions and 846 deletions.
Expand Up @@ -27,6 +27,8 @@
import com.evolveum.midpoint.web.component.util.EnableBehaviour;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;
import com.evolveum.midpoint.web.page.admin.configuration.component.HeaderMenuAction;

import org.apache.commons.lang.BooleanUtils;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
Expand All @@ -46,6 +48,7 @@
* @author honchar
* @author Viliam Repan (lazyman)
* <p>
*
*/
public class InlineMenuButtonColumn<T extends Serializable> extends AbstractColumn<T, String> {

Expand Down Expand Up @@ -88,6 +91,11 @@ private Component getPanel(String componentId, IModel<T> rowModel,
if (rowModel != null && menuItem.getAction() != null && menuItem.getAction() instanceof ColumnMenuAction){
((ColumnMenuAction) menuItem.getAction()).setRowModel(rowModel);
}

if (menuItem.isCheckVisibility() && !isInlineMenuVisible(rowModel, isHeaderPanel)) {
continue;
}

filteredMenuItems.add(menuItem);
}
if (rowModel != null && rowModel.getObject() instanceof InlineMenuable &&
Expand Down Expand Up @@ -127,6 +135,10 @@ protected AjaxIconButton createButton(int index, String componentId, IModel<T> m
}
};
}

protected boolean isInlineMenuVisible(IModel<T> rowModel, boolean isHeader) {
return true;
}

protected boolean isButtonMenuItemEnabled(IModel<T> rowModel){
return true;
Expand Down Expand Up @@ -233,6 +245,7 @@ private boolean isPanelVisible(boolean isHeaderPanel){
if (!isHeaderPanel && !(item.getAction() instanceof HeaderMenuAction)){
return true;
}

}
return false;
}
Expand Down
Expand Up @@ -20,6 +20,7 @@
import org.apache.wicket.model.Model;

import java.io.Serializable;
import java.util.function.Supplier;

/**
* TODO: update to better use with DropdownButtonPanel. Move away from depreated com.evolveum.midpoint.web.component.menu.cog.
Expand All @@ -35,6 +36,8 @@ public abstract class InlineMenuItem implements Serializable {
private boolean submit = false;
private InlineMenuItemAction action;
private int id = -1;

private boolean checkVisibility;

public InlineMenuItem(IModel<String> label) {
this.label = label;
Expand Down Expand Up @@ -115,4 +118,13 @@ public IModel<String> getConfirmationMessageModel() {
public boolean showConfirmationDialog() {
return true;
}

public boolean isCheckVisibility() {
return checkVisibility;
}

public void setCheckVisibility(boolean checkVisibility) {
this.checkVisibility = checkVisibility;
}

}

0 comments on commit f4c5595

Please sign in to comment.