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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn event fired after the pop-up for thePopupButtonreturned byPopupButton.PopupCloseEvent.getPopupButton()has been closed.static interfaceInterface for listening for aPopupButton.PopupCloseEventfired by aPopupButton.static classAn event fired after the pop-up button returned byPopupButton.PopupOpenEvent.getPopupButton()has been clicked and the pop-up has been opened.static interfaceInterface for listening for aPopupButton.PopupOpenEventfired by aPopupButton. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new PopupButton.PopupButton(com.vaadin.flow.component.Component content) Constructs a new PopupButton with the given content. -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationAdds aPopupButton.PopupCloseListenerto this pop-up button.com.vaadin.flow.shared.RegistrationAdds aPopupButton.PopupOpenListenerto this pop-up button.voidCloses the pop-up if it is open.org.apache.poi.ss.util.CellReferenceGets the cell reference for the cell that contains this pop-up button.intGets the column for this pop-up button.com.vaadin.flow.component.ComponentGet the contents of the popup.Gets the height for this pop-up button's pop-up.Gets the width for this pop-up button's pop-up.intgetRow()Gets the row for this pop-up button.protected PopupButtonStategetState()booleanisActive()booleanTells if the pop-up header is currently hidden.voidmarkActive(boolean active) Mark the button with "active" - style.voidOpens 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, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
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-truefor hidden,falsefor visible.
-
setPopupWidth
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
Gets the width for this pop-up button's pop-up. Can be null or empty.- Returns:
- Width of the pop-up
-
setPopupHeight
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
Gets the height for this pop-up button's pop-up. Can be null or empty.- Returns:
- Height of the pop-up
-
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
-