Skip to content

Commit

Permalink
merge master into v3
Browse files Browse the repository at this point in the history
  • Loading branch information
andi-huber committed Oct 31, 2024
2 parents f7432e6 + 2d9054a commit c00d08e
Showing 1 changed file with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,12 @@ private CssMenuItem(final String name, final Menuable.Kind menuableKind) {
}

private final List<CssMenuItem> subMenuItems = _Lists.newArrayList();
protected void addSubMenuItem(final CssMenuItem cssMenuItem) {
protected final void addSubMenuItem(final CssMenuItem cssMenuItem) {
subMenuItems.add(cssMenuItem);
}
public Can<CssMenuItem> getSubMenuItems() {
return Can.ofCollection(subMenuItems);
}
/**
* @param menuItems we assume these have the correct parent already set
*/
public void replaceSubMenuItems(final List<CssMenuItem> menuItems) {
subMenuItems.clear();
subMenuItems.addAll(menuItems);
}
public boolean hasSubMenuItems() {
return subMenuItems.size() > 0;
}
Expand All @@ -107,19 +100,17 @@ void addTo(final MarkupContainer markupContainer) {
private Component addMenuItemComponentTo(final MarkupContainer markupContainer) {

var linkAndLabel = getLinkAndLabel();
var actionLink = getLinkAndLabel().getUiComponent();
var actionLink = linkAndLabel.getUiComponent();

var label = Wkt.labelAdd(markupContainer, CssMenuItem.ID_MENU_LABEL, this::getName);

if (actionLink != null) {

// show link...
markupContainer.add(actionLink);
actionLink.add(label);

WktDecorators.decorateCssMenuItem(
linkAndLabel.getUiComponent(),
label,
WktDecorators.decorateMenuAction(
actionLink, actionLink, label,
ActionDecorationModel.builder(linkAndLabel)
.actionStyle(ActionStyle.MENU_ITEM)
.build());
Expand All @@ -138,8 +129,6 @@ private Component addMenuItemComponentTo(final MarkupContainer markupContainer)

label.add(new AttributeModifier("class", Model.of("disabled")));

markupContainer.add(label);

return label;
}
}
Expand Down

0 comments on commit c00d08e

Please sign in to comment.