com.vaadin.flow.component.spreadsheet.
Class PopupButton
- java.lang.Object
-
- com.vaadin.flow.component.Component
-
- com.vaadin.flow.component.spreadsheet.PopupButton
-
All Implemented Interfaces:
AttachNotifier
,DetachNotifier
,HasComponents
,HasElement
,HasEnabled
,Serializable
@Tag("div") public class PopupButton extends Component implements HasComponents
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)
orSpreadsheet.setPopup(int, int, PopupButton)
. The button can be removed from the target cell by givingnull
as the PopupButton parameter to one of the previously mentioned methods.Author:
Vaadin Ltd.
See Also:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PopupButton.PopupCloseEvent
An event fired after the pop-up for the
PopupButton
returned byPopupButton.PopupCloseEvent.getPopupButton()
has been closed.static interface
PopupButton.PopupCloseListener
Interface for listening for a
PopupButton.PopupCloseEvent
fired by aPopupButton
.static class
PopupButton.PopupOpenEvent
An event fired after the pop-up button returned by
PopupButton.PopupOpenEvent.getPopupButton()
has been clicked and the pop-up has been opened.static interface
PopupButton.PopupOpenListener
Interface for listening for a
PopupButton.PopupOpenEvent
fired by aPopupButton
.
-
Constructor Summary
Constructors Constructor Description PopupButton()
Constructs a new PopupButton.
PopupButton(Component content)
Constructs a new PopupButton with the given content.
-
Method Summary
All Methods Modifier and Type Method Description void
addPopupCloseListener(PopupButton.PopupCloseListener listener)
Adds a
PopupButton.PopupCloseListener
to this pop-up button.void
addPopupOpenListener(PopupButton.PopupOpenListener listener)
Adds a
PopupButton.PopupOpenListener
to this pop-up button.void
closePopup()
Closes the pop-up if it is open.
org.apache.poi.ss.util.CellReference
getCellReference()
Gets the cell reference for the cell that contains this pop-up button.
int
getColumn()
Gets the column for this pop-up button.
Component
getContent()
Get the contents of the popup.
String
getPopupHeight()
Gets the height for this pop-up button's pop-up.
String
getPopupWidth()
Gets the width for this pop-up button's pop-up.
int
getRow()
Gets the row for this pop-up button.
protected PopupButtonState
getState()
protected PopupButtonState
getState(boolean markAsDirty)
boolean
isActive()
boolean
isHeaderHidden()
Tells if the pop-up header is currently hidden.
Iterator<Component>
iterator()
void
markActive(boolean active)
Mark the button with "active" - style.
void
openPopup()
Opens the pop-up if the button is currently rendered in the visible area of the Spreadsheet.
void
removePopupCloseListener(PopupButton.PopupCloseListener listener)
Removes the given
PopupButton.PopupCloseListener
from this pop-up button.void
removePopupOpenListener(PopupButton.PopupOpenListener listener)
Removes the given
PopupButton.PopupOpenListener
from this pop-up button.void
setContent(Component content)
Set the contents of the popup.
void
setHeaderHidden(boolean headerHidden)
Sets the pop-up header visible or hidden.
void
setPopupHeight(String height)
Set the height for this pop-up button's pop-up.
void
setPopupWidth(String width)
Set the width for this pop-up button's pop-up.
-
Methods inherited from class com.vaadin.flow.component.Component
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, scrollIntoView, set, setElement, setId, setVisible
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
-
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
-
Methods inherited from interface com.vaadin.flow.component.HasComponents
add, add, addComponentAsFirst, addComponentAtIndex, remove, removeAll
-
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
-
Methods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabled
-
-
-
-
Constructor Detail
-
PopupButton
public PopupButton()
Constructs a new PopupButton.
-
PopupButton
public PopupButton(Component content)
Constructs a new PopupButton with the given content.
Parameters:
content
- Content of the pop-up
-
-
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
-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()
-
getState
protected PopupButtonState getState(boolean markAsDirty)
-
setContent
public void setContent(Component content)
Set the contents of the popup.
-
getContent
public 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 void addPopupOpenListener(PopupButton.PopupOpenListener listener)
Adds a
PopupButton.PopupOpenListener
to this pop-up button.Parameters:
listener
- The listener to add
-
removePopupOpenListener
public void removePopupOpenListener(PopupButton.PopupOpenListener listener)
Removes the given
PopupButton.PopupOpenListener
from this pop-up button.Parameters:
listener
- The listener to remove
-
addPopupCloseListener
public void addPopupCloseListener(PopupButton.PopupCloseListener listener)
Adds a
PopupButton.PopupCloseListener
to this pop-up button.Parameters:
listener
-
-
removePopupCloseListener
public void removePopupCloseListener(PopupButton.PopupCloseListener listener)
Removes the given
PopupButton.PopupCloseListener
from this pop-up button.Parameters:
listener
-
-
-