Skip to content

Commit

Permalink
popover arrow style fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Kateryna Honchar committed Jun 27, 2022
1 parent 3a18374 commit 494700e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ private void initLayout() {
public Component getPopoverReferenceComponent() {
return SelectableItemListPopoverPanel.this.getPopoverReferenceComponent();
}

@Override
protected String getArrowCustomStyle() {
return getPopoverCustomArrowStyle();
}
};
add(popover);

Expand Down Expand Up @@ -217,4 +222,8 @@ protected IModel<String> getPopoverTitleModel() {
public void togglePopover(AjaxRequestTarget target) {
((Popover) get(ID_POPOVER)).toggle(target);
}

protected String getPopoverCustomArrowStyle() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
~ and European Union Public License. See LICENSE file for details.
-->
<wicket:border xmlns:wicket="http://wicket.apache.org">
<div class="arrow"></div>
<div wicket:id="arrow" class="arrow" ></div>
<h3 class="popover-title" wicket:id="title"></h3>
<div class="popover-body">
<div class="popover-body" style="min-width: 200px;">
<wicket:body/>
</div>
</wicket:border>
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@

package com.evolveum.midpoint.gui.impl.component.search;

import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.border.Border;
import org.apache.wicket.model.IModel;
Expand All @@ -24,7 +26,7 @@ public abstract class Popover extends Border {

private static final long serialVersionUID = 1L;

private static final String ID_POPOVER = "popover";
private static final String ID_ARROW = "arrow";
private static final String ID_TITLE = "title";

private IModel<String> title;
Expand All @@ -51,10 +53,20 @@ private void initLayout() {
Label title = new Label(ID_TITLE, this.title);
title.add(new VisibleBehaviour(() -> Popover.this.title.getObject() != null));
addToBorder(title);

WebMarkupContainer arrow = new WebMarkupContainer(ID_ARROW);
if (StringUtils.isNotEmpty(getArrowCustomStyle())) {
arrow.add(AttributeAppender.append("style", getArrowCustomStyle()));
}
addToBorder(arrow);
}

public void toggle(AjaxRequestTarget target) {
target.appendJavaScript("$(function() { MidPointTheme.togglePopover('#" +
getPopoverReferenceComponent().getMarkupId() + "', '#" + getMarkupId() + "'); });");
}

protected String getArrowCustomStyle() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ public abstract class SearchPanel<C extends Containerable> extends BasePanel<Sea
private static final String ID_SAVE_SEARCH_CONTAINER = "saveSearchContainer";
private static final String ID_SAVE_SEARCH_BUTTON = "saveSearchButton";
private static final String ID_SAVED_SEARCH_MENU = "savedSearchMenu";
private static final String ID_SAVED_SEARCH_ITEMS = "savedSearchItems";
private static final String ID_SAVED_SEARCH_ITEM = "savedSearchItem";
private static final String ID_BASIC_SEARCH_FRAGMENT = "basicSearchFragment";
private static final String ID_ADVANCED_SEARCH_FRAGMENT = "advancedSearchFragment";
private static final String ID_FULLTEXT_SEARCH_FRAGMENT = "fulltextSearchFragment";
Expand Down Expand Up @@ -306,6 +304,11 @@ protected String getItemHelp(AvailableFilterType item) {
protected IModel<String> getPopoverTitleModel() {
return createStringResource("SearchPanel.availableFilters");
}

@Override
protected String getPopoverCustomArrowStyle() {
return "padding-left: 40px;";
}
};
saveSearchContainer.add(savedFiltersPopover);

Expand Down

0 comments on commit 494700e

Please sign in to comment.