com.vaadin.ui.
Class PopupView
- java.lang.Object
-
- com.vaadin.server.AbstractClientConnector
-
- com.vaadin.ui.AbstractComponent
-
- com.vaadin.ui.PopupView
-
All Implemented Interfaces:
ContextClickEvent.ContextClickNotifier
,MethodEventSource
,ClientConnector
,Sizeable
,Connector
,Component
,HasComponents
,Serializable
,Iterable<Component>
public class PopupView extends AbstractComponent implements HasComponents
A component for displaying a two different views to data. The minimized view is normally used to render the component, and when it is clicked the full view is displayed on a popup. The inner class
PopupView.Content
is used to deliver contents to this component.Author:
Vaadin Ltd.
See Also:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
PopupView.Content
Used to deliver customized content-packages to the PopupView.
static class
PopupView.PopupVisibilityEvent
This event is received by the PopupVisibilityListeners when the visibility of the popup changes.
static interface
PopupView.PopupVisibilityListener
Defines a listener that can receive a PopupVisibilityEvent when the visibility of the popup changes.
-
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
-
Nested classes/interfaces inherited from interface com.vaadin.ui.Component
Component.ErrorEvent, Component.Event, Component.Focusable, Component.Listener
-
Nested classes/interfaces inherited from interface com.vaadin.ui.HasComponents
HasComponents.ComponentAttachDetachNotifier, HasComponents.ComponentAttachEvent, HasComponents.ComponentAttachListener, HasComponents.ComponentDetachEvent, HasComponents.ComponentDetachListener
-
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable
Sizeable.Unit
-
-
Field Summary
-
Fields inherited from class com.vaadin.ui.AbstractComponent
DESIGN_ATTR_PLAIN_TEXT
-
Fields inherited from interface com.vaadin.server.Sizeable
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
-
-
Method Summary
All Methods Modifier and Type Method Description Registration
addPopupVisibilityListener(PopupView.PopupVisibilityListener listener)
Add a listener that is called whenever the visibility of the popup is changed.
void
beforeClientResponse(boolean initial)
Called before the shared state and RPC invocations are sent to the client.
protected static PopupView.Content
createContent(String minimizedValue, Component popupContent)
Creates a Content from given text representation and popup content.
void
detach()
Notifies the connector that it is detached from its VaadinSession.
int
getComponentCount()
Gets the number of contained components.
PopupView.Content
getContent()
Returns the content-package for this PopupView.
protected PopupViewState
getState()
Returns the shared state bean with information to be sent from the server to the client.
protected PopupViewState
getState(boolean markAsDirty)
Returns the shared state for this connector.
boolean
isHideOnMouseOut()
Check if this popup will be hidden when the user takes the mouse cursor out of the popup area.
boolean
isPopupVisible()
Return whether the popup is visible.
Iterator<Component>
iterator()
This class only contains other components when the popup is showing.
void
readDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Reads the component state from the given design.
void
removePopupVisibilityListener(PopupView.PopupVisibilityListener listener)
Deprecated.
As of 8.0, replaced byRegistration.remove()
in the registration object returned fromaddPopupVisibilityListener(PopupVisibilityListener)
.void
setContent(PopupView.Content newContent)
This method will replace the current content of the panel with a new one.
void
setHideOnMouseOut(boolean hideOnMouseOut)
Should the popup automatically hide when the user takes the mouse cursor out of the popup area? If this is false, the user must click outside the popup to close it.
void
setPopupVisible(boolean visible)
Set the visibility of the popup.
void
setVisible(boolean visible)
Sets the visibility of the component.
void
writeDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Writes the component state to the given design.
-
Methods inherited from class com.vaadin.ui.AbstractComponent
addContextClickListener, addListener, addShortcutListener, addStyleName, attach, findAncestor, fireComponentErrorEvent, fireComponentEvent, focus, getActionManager, getCaption, getComponentError, getCustomAttributes, getData, getDebugId, getDescription, getErrorMessage, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isReadOnly, isRequiredIndicatorVisible, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setDescription, setEnabled, setHeight, setHeight, setHeightFull, setHeightUndefined, setIcon, setId, setLocale, setParent, setPrimaryStyleName, setReadOnly, setRequiredIndicatorVisible, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setWidth, setWidth, setWidthFull, setWidthUndefined
-
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstate
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
-
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, addStyleNames, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, removeListener, removeStyleName, removeStyleNames, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setStyleName, setStyleName
-
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface com.vaadin.server.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightFull, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull, setWidthUndefined
-
-
-
-
Constructor Detail
-
PopupView
@Deprecated public PopupView()
Deprecated.This is an internal constructor. Use
PopupView(String, Component)
instead.Since:
7.5.0
-
PopupView
public PopupView(String small, Component large)
A simple way to create a PopupPanel. Note that the minimal representation may not be dynamically updated, in order to achieve this create your own Content object and use
PopupView(Content)
.Parameters:
small
- the minimal textual representation as HTMLlarge
- the full, Component-type representation
-
PopupView
public PopupView(PopupView.Content content)
Creates a PopupView through the PopupView.Content interface. This allows the creator to dynamically change the contents of the PopupView.
Parameters:
content
- the PopupView.Content that contains the information for this
-
-
Method Detail
-
createContent
protected static PopupView.Content createContent(String minimizedValue, Component popupContent)
Creates a Content from given text representation and popup content.
Parameters:
minimizedValue
- text representation when popup is hiddenpopupContent
- popup contentReturns:
content with given data
Since:
7.5.0
-
setContent
public void setContent(PopupView.Content newContent) throws IllegalArgumentException
This method will replace the current content of the panel with a new one.
Parameters:
newContent
- PopupView.Content object containing new information for the PopupViewThrows:
IllegalArgumentException
- if the method is passed a null value, or if one of the content methods returns null
-
getContent
public PopupView.Content getContent()
Returns the content-package for this PopupView.
Returns:
the PopupView.Content for this object or null
-
setPopupVisible
public void setPopupVisible(boolean visible)
Set the visibility of the popup. Does not hide the minimal representation.
Parameters:
visible
-
-
beforeClientResponse
public void beforeClientResponse(boolean initial)
Description copied from interface:
ClientConnector
Called before the shared state and RPC invocations are sent to the client. Gives the connector an opportunity to set computed/dynamic state values or to invoke last minute RPC methods depending on other component features.
Specified by:
beforeClientResponse
in interfaceClientConnector
Overrides:
beforeClientResponse
in classAbstractComponent
Parameters:
initial
-true
if the client-side connector will be created and initialized after this method has been invoked.false
if there is already an initialized client-side connector.
-
isPopupVisible
public boolean isPopupVisible()
Return whether the popup is visible.
Returns:
true if the popup is showing
-
isHideOnMouseOut
public boolean isHideOnMouseOut()
Check if this popup will be hidden when the user takes the mouse cursor out of the popup area.
Returns:
true if the popup is hidden on mouse out, false otherwise
-
setHideOnMouseOut
public void setHideOnMouseOut(boolean hideOnMouseOut)
Should the popup automatically hide when the user takes the mouse cursor out of the popup area? If this is false, the user must click outside the popup to close it. The default is true.
Parameters:
hideOnMouseOut
-
-
iterator
public Iterator<Component> iterator()
This class only contains other components when the popup is showing.
Specified by:
iterator
in interfaceHasComponents
Specified by:
iterator
in interfaceIterable<Component>
Returns:
the component iterator.
See Also:
-
getComponentCount
public int getComponentCount()
Gets the number of contained components.
Returns:
the number of contained components (zero or one)
-
readDesign
public void readDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Description copied from interface:
Component
Reads the component state from the given design.
The component is responsible not only for updating its own state but also for ensuring that its children update their state based on the design.
It is assumed that the component is in its default state when this method is called. Reading should only take into consideration attributes specified in the design and not reset any unspecified attributes to their defaults.
This method must not modify the design.
Specified by:
readDesign
in interfaceComponent
Overrides:
readDesign
in classAbstractComponent
Parameters:
design
- The element to obtain the state fromdesignContext
- The DesignContext instance used for parsing the design
-
writeDesign
public void writeDesign(org.jsoup.nodes.Element design, DesignContext designContext)
Description copied from interface:
Component
Writes the component state to the given design.
The component is responsible not only for writing its own state but also for ensuring that its children write their state to the design.
This method must not modify the component state.
Specified by:
writeDesign
in interfaceComponent
Overrides:
writeDesign
in classAbstractComponent
Parameters:
design
- The element to write the component state to. Any previous attributes or child nodes are not cleared.designContext
- The DesignContext instance used for writing the design
-
getState
protected PopupViewState getState()
Description copied from class:
AbstractComponent
Returns the shared state bean with information to be sent from the server to the client. Subclasses should override this method and set any relevant fields of the state returned by super.getState().
Overrides:
getState
in classAbstractComponent
Returns:
updated component shared state
-
getState
protected PopupViewState getState(boolean markAsDirty)
Description copied from class:
AbstractClientConnector
Returns the shared state for this connector.
Overrides:
getState
in classAbstractComponent
Parameters:
markAsDirty
- true if the connector should automatically be marked dirty, false otherwiseReturns:
The shared state for this connector. Never null.
See Also:
-
addPopupVisibilityListener
public Registration addPopupVisibilityListener(PopupView.PopupVisibilityListener listener)
Add a listener that is called whenever the visibility of the popup is changed.
Parameters:
listener
- the listener to add, not nullReturns:
a registration object for removing the listener
Since:
8.0
See Also:
PopupView.PopupVisibilityListener
,PopupView.PopupVisibilityEvent
-
removePopupVisibilityListener
@Deprecated public void removePopupVisibilityListener(PopupView.PopupVisibilityListener listener)
Deprecated.As of 8.0, replaced byRegistration.remove()
in the registration object returned fromaddPopupVisibilityListener(PopupVisibilityListener)
.Removes a previously added listener, so that it no longer receives events when the visibility of the popup changes.
Parameters:
listener
- the listener to removeSee Also:
PopupView.PopupVisibilityListener
,addPopupVisibilityListener(PopupVisibilityListener)
-
detach
public void detach()
Description copied from class:
AbstractClientConnector
Notifies the connector that it is detached from its VaadinSession.
The caller of this method is
Component.setParent(HasComponents)
if the parent is in the session. When the parent is detached from the session it is its responsibility to callClientConnector.detach()
for each of its children.The
AbstractClientConnector.getSession()
andAbstractClientConnector.getUI()
methods might returnnull
after this method is called.Specified by:
detach
in interfaceClientConnector
Overrides:
detach
in classAbstractComponent
-
setVisible
public void setVisible(boolean visible)
Description copied from interface:
Component
Sets the visibility of the component.
Visible components are drawn in the user interface, while invisible ones are not. The effect is not merely a cosmetic CSS change - no information about an invisible component will be sent to the client. The effect is thus the same as removing the component from its parent.
TextField readonly = new TextField("Read-Only"); readonly.setValue("You can't see this!"); readonly.setVisible(false); layout.addComponent(readonly);
A component is visible only if all of its parents are also visible. If a component is explicitly set to be invisible, changes in the visibility of its parents will not change the visibility of the component.
Specified by:
setVisible
in interfaceComponent
Overrides:
setVisible
in classAbstractComponent
Parameters:
visible
- the boolean value specifying if the component should be visible after the call or not.See Also:
-
-