Usage Example:
// Create a new popover attached to an HTML element
Element targetElement = document.getElementById("popover-target");
BasePopover< MyPopover> popover = new MyPopover(targetElement);
// Customize the popover
popover.withHeader(header -> header.setTextContent("Popover Header"));
popover.withBody(body -> body.setTextContent("Popover Content"));
// Show the popover
popover.expand();
T
The type of the popover class that extends BasePopover .
See also :
Usage Example:
HTMLElement targetElement = document.getElementById("targetElement");
Popover popover = Popover.create(targetElement)
.setOpenOnClick(true) // Open the popover on click
.setCloseOnEscape(true) // Close the popover when pressing the "Escape" key
.setModal(false); // Make the popover non-modal
Usage example:
Tooltip.create(element, "This is a tooltip");
public void BasePopover()
public int getOpenDelay()
delay in milliseconds before showing the popover.
public T setOpenDelay(int openDelay)
openDelay
milliseconds to wait before showing the popover.
same component instance
public T expand()
The current instance of the popover.
public T open()
The instance of the popover after opening.
public T close()
The instance of the popover after closing.
public boolean isModal()
false since popovers are not modal by default.
public boolean isAutoClose()
true since popovers are set to close automatically by default.
public void discard()
public T setPosition(DropDirection position)
position
The desired position of the popover.
The current instance of the popover.
public T setCloseOthers(boolean closeOthers)
closeOthers
true to close other popovers, false to keep them open.
The current instance of the popover.
public DivElement getArrowElement()
The arrow element of the popover.
public T withArrow(ChildHandler<T, DivElement> handler)
handler
A function to customize the arrow element.
The current instance of the popover.
public DivElement getHeaderElement()
The header element of the popover.
public T withHeader(ChildHandler<T, DivElement> handler)
handler
A function to customize the header element.
The current instance of the popover.
public DivElement getBody()
The body element of the popover.
public T withBody(ChildHandler<T, DivElement> handler)
handler
A function to customize the body element.
The current instance of the popover.
public HTMLElement getAppendTarget()
The HTML element to which the popover's content should be appended.
public T closeOnScroll(boolean closeOnScroll)
closeOnScroll
true to enable automatic closing on page scroll, false otherwise.
The updated instance of the popover.
public T setOpenCondition(Supplier<Boolean> openCondition)
true .
openCondition
The supplier that provides the open condition.
The updated instance of the popover.
public boolean isCloseOnBlur()
true if the popover should be closed on blur, false otherwise.
public T setCloseOnBlur(boolean closeOnBlur)
closeOnBlur
true to close on blur, false to keep it open.
The current instance of the popover.
public HTMLDivElement element()
The DOM element of the popover.
public boolean isCloseOnScroll()
true if the popover should close on page scroll, false otherwise.
public boolean isFollowerOpen()
true if the follower is open, false otherwise.
public void positionFollower()
public void Popover(HTMLElement target)
target
The HTML element to associate the popover with.
public void Popover()
public static Popover create(HTMLElement target)
target
The HTML element to associate the popover with.
A new `Popover` instance.
public static Popover create(IsElement<? extends HTMLElement> target)
target
The IsElement target to associate the popover with.
A new `Popover` instance.
public Popover detach()
The detached `Popover` instance.
public Popover closeOnEscape(boolean closeOnEscape)
closeOnEscape
true to close on "Escape" key press, false otherwise.
The updated `Popover` instance.
public boolean isOpenOnClick()
true if the `Popover` opens on click, false otherwise.
public Popover setOpenOnClick(boolean openOnClick)
openOnClick
true to open on click, false otherwise.
The updated `Popover` instance.
public Popover setModal(boolean modal)
modal
true for modal, false for non-modal.
The updated `Popover` instance.
public boolean isModal()
Determines whether this popover is displayed as a modal dialog. If the popover is modal, it will prevent interactions with elements behind it while open.
Returns:
true if the popover is modal, false otherwise.
public void Tooltip(Element target, Node content)
target
The target element.
content
The content node of the tooltip.
public void Tooltip(Node content)
content
The content node of the tooltip.
public static Tooltip create(Element target, String text)
target
The target element.
text
The text of the tooltip.
The created tooltip.
public static Tooltip create(IsElement<? extends Element> target, String text)
target
The target element.
text
The text of the tooltip.
The created tooltip.
public static Tooltip create(Element target, Node content)
target
The target element.
content
The content node of the tooltip.
The created tooltip.
public static Tooltip create(IsElement<? extends Element> target, Node content)
target
The target element.
content
The content node of the tooltip.
The created tooltip.
public void detach()