Class PopupButton

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.spreadsheet.PopupButton
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasStyle, Serializable

@Tag("div") public class PopupButton extends com.vaadin.flow.component.Component
A button component that when clicked opens a pop-up next to spreadsheet cell containing the button.

Vaadin components can be added inside the pop-up.

By default, the pop-up displays a close-button and a header containing the current value of the cell that the pop-up button belongs to.

A button can be marked with "active" style with markActive(boolean).

To add the pop-up button to a specific spreadsheet, call Spreadsheet.setPopup(CellReference, PopupButton), Spreadsheet.setPopup(String, PopupButton) or Spreadsheet.setPopup(int, int, PopupButton). The button can be removed from the target cell by giving null as the PopupButton parameter to one of the previously mentioned methods.

Author:
Vaadin Ltd.
See Also:
  • Constructor Details

    • PopupButton

      public PopupButton()
      Constructs a new PopupButton.
    • PopupButton

      public PopupButton(com.vaadin.flow.component.Component content)
      Constructs a new PopupButton with the given content.
      Parameters:
      content - Content of the pop-up
  • Method Details

    • getCellReference

      public org.apache.poi.ss.util.CellReference getCellReference()
      Gets the cell reference for the cell that contains this pop-up button.
      Returns:
      Target cell reference
    • getColumn

      public int getColumn()
      Gets the column for this pop-up button.
      Returns:
      Column index, 0-based
    • getRow

      public int getRow()
      Gets the row for this pop-up button.
      Returns:
      Row index, 0-based
    • openPopup

      public void openPopup()
      Opens the pop-up if the button is currently rendered in the visible area of the Spreadsheet.
    • closePopup

      public void closePopup()
      Closes the pop-up if it is open.
    • isHeaderHidden

      public boolean isHeaderHidden()
      Tells if the pop-up header is currently hidden.
      Returns:
      true if header is hidden, false otherwise
    • setHeaderHidden

      public void setHeaderHidden(boolean headerHidden)
      Sets the pop-up header visible or hidden.
      Parameters:
      headerHidden - true for hidden, false for visible.
    • setPopupWidth

      public void setPopupWidth(String width)
      Set the width for this pop-up button's pop-up. Can be null or empty for undefined width.
      Parameters:
      width - New width for the pop-up
    • getPopupWidth

      public String getPopupWidth()
      Gets the width for this pop-up button's pop-up. Can be null or empty.
      Returns:
      Width of the pop-up
    • setPopupHeight

      public void setPopupHeight(String height)
      Set the height for this pop-up button's pop-up. Can be null or empty for undefined height.
      Parameters:
      height - New height for the pop-up
    • getPopupHeight

      public String getPopupHeight()
      Gets the height for this pop-up button's pop-up. Can be null or empty.
      Returns:
      Height of the pop-up
    • getState

      protected PopupButtonState getState()
    • setContent

      public void setContent(com.vaadin.flow.component.Component content)
      Set the contents of the popup.
    • getContent

      public com.vaadin.flow.component.Component getContent()
      Get the contents of the popup.
    • markActive

      public void markActive(boolean active)
      Mark the button with "active" - style. See PopupButtonWidget for the CSS class name.
      Parameters:
      active - true to add "active" style, false to remove it
    • isActive

      public boolean isActive()
    • addPopupOpenListener

      public com.vaadin.flow.shared.Registration addPopupOpenListener(PopupButton.PopupOpenListener listener)
      Adds a PopupButton.PopupOpenListener to this pop-up button.
      Parameters:
      listener - The listener to add
      Returns:
      a Registration for removing the event listener
    • addPopupCloseListener

      public com.vaadin.flow.shared.Registration addPopupCloseListener(PopupButton.PopupCloseListener listener)
      Adds a PopupButton.PopupCloseListener to this pop-up button.
      Parameters:
      listener - The listener to add
      Returns:
      a Registration for removing the event listener