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,Serializable
@Tag("div") public class PopupButton extends com.vaadin.flow.component.ComponentA 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)orSpreadsheet.setPopup(int, int, PopupButton). The button can be removed from the target cell by givingnullas the PopupButton parameter to one of the previously mentioned methods.- Author:
- Vaadin Ltd.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPopupButton.PopupCloseEventAn event fired after the pop-up for thePopupButtonreturned byPopupButton.PopupCloseEvent.getPopupButton()has been closed.static interfacePopupButton.PopupCloseListenerInterface for listening for aPopupButton.PopupCloseEventfired by aPopupButton.static classPopupButton.PopupOpenEventAn event fired after the pop-up button returned byPopupButton.PopupOpenEvent.getPopupButton()has been clicked and the pop-up has been opened.static interfacePopupButton.PopupOpenListenerInterface for listening for aPopupButton.PopupOpenEventfired by aPopupButton.
-
Constructor Summary
Constructors Constructor Description PopupButton()Constructs a new PopupButton.PopupButton(com.vaadin.flow.component.Component content)Constructs a new PopupButton with the given content.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.vaadin.flow.shared.RegistrationaddPopupCloseListener(PopupButton.PopupCloseListener listener)Adds aPopupButton.PopupCloseListenerto this pop-up button.com.vaadin.flow.shared.RegistrationaddPopupOpenListener(PopupButton.PopupOpenListener listener)Adds aPopupButton.PopupOpenListenerto this pop-up button.voidclosePopup()Closes the pop-up if it is open.org.apache.poi.ss.util.CellReferencegetCellReference()Gets the cell reference for the cell that contains this pop-up button.intgetColumn()Gets the column for this pop-up button.com.vaadin.flow.component.ComponentgetContent()Get the contents of the popup.StringgetPopupHeight()Gets the height for this pop-up button's pop-up.StringgetPopupWidth()Gets the width for this pop-up button's pop-up.intgetRow()Gets the row for this pop-up button.protected PopupButtonStategetState()booleanisActive()booleanisHeaderHidden()Tells if the pop-up header is currently hidden.voidmarkActive(boolean active)Mark the button with "active" - style.voidopenPopup()Opens the pop-up if the button is currently rendered in the visible area of the Spreadsheet.voidsetContent(com.vaadin.flow.component.Component content)Set the contents of the popup.voidsetHeaderHidden(boolean headerHidden)Sets the pop-up header visible or hidden.voidsetPopupHeight(String height)Set the height for this pop-up button's pop-up.voidsetPopupWidth(String width)Set the width for this pop-up button's pop-up.-
Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, scrollIntoView, set, setElement, setId, setVisible
-
-
-
-
Method Detail
-
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-truefor hidden,falsefor 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 aPopupButton.PopupOpenListenerto this pop-up button.- Parameters:
listener- The listener to add- Returns:
- a
Registrationfor removing the event listener
-
addPopupCloseListener
public com.vaadin.flow.shared.Registration addPopupCloseListener(PopupButton.PopupCloseListener listener)
Adds aPopupButton.PopupCloseListenerto this pop-up button.- Parameters:
listener- The listener to add- Returns:
- a
Registrationfor removing the event listener
-
-