Class Panel
- All Implemented Interfaces:
Action.Container,Action.Notifier,ClientConnector,Sizeable,Focusable,HasComponents,HasComponents.ComponentAttachDetachNotifier,SingleComponentContainer,com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasLabel,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.shared.HasTooltip,Serializable,Iterable<com.vaadin.flow.component.Component>
- Author:
- Vaadin Ltd.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.classic.v8.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.DetachEvent, ClientConnector.DetachListenerNested classes/interfaces inherited from interface com.vaadin.classic.v8.ui.HasComponents
HasComponents.ComponentAttachDetachNotifier, HasComponents.ComponentAttachEvent, HasComponents.ComponentAttachListener, HasComponents.ComponentDetachEvent, HasComponents.ComponentDetachListener -
Field Summary
Fields inherited from interface com.vaadin.classic.v8.server.Sizeable
SIZE_UNDEFINED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T extends Action & Action.Listener>
voidaddAction(T action) Deprecated.voidaddActionHandler(Action.Handler actionHandler) Deprecated.com.vaadin.flow.shared.RegistrationaddClickListener(MouseEvents.ClickListener listener) Add a click listener to the Panel.voidbeforeClientResponse(boolean initial) Called before the response is written to client side.voidfocus()Sets the focus for this component if the component isFocusable.Gets the caption of the component.getIcon()Non-op method.com.vaadin.flow.component.icon.IconGets the icon resource of the component.intGets scroll left offset.intGets scroll top offset.intGets the tabulator index of theFocusablecomponent.booleanChecks whether captions are rendered as HTML<T extends Action & Action.Listener>
voidremoveAction(T action) Deprecated.voidremoveActionHandler(Action.Handler actionHandler) Deprecated.voidsetCaption(String caption) Sets the caption of the component.voidsetCaptionAsHtml(boolean captionAsHtml) Sets whether the caption is rendered as HTML.voidsetIcon(com.vaadin.flow.component.icon.Icon icon) Sets the icon of the component.voidsetScrollLeft(int scrollLeft) Sets scroll left offset.voidsetScrollTop(int scrollTop) Sets scroll top offset.voidsetTabIndex(int tabIndex) Sets the tabulator index of theFocusablecomponent.Methods inherited from class com.vaadin.classic.v8.ui.AbstractSingleComponentContainer
addComponentAttachListener, addComponentDetachListener, fireComponentAttachEvent, fireComponentDetachEvent, getComponentCount, getContent, getContentWrapper, iterator, onAttach, removeFromParent, setContent, setContentWrapper, setHeight, setWidthMethods inherited from class com.vaadin.classic.v8.ui.AbstractComponent
addClassName, addClassNames, addInternalStyles, addListener, addShortcutListener, addStyleName, addStyleNames, doSetHeight, doSetWidth, fireComponentErrorEvent, fireComponentEvent, getActionManager, getClassName, getClassNames, getComponentError, getCustomAttributes, getCustomStyles, getData, getDescription, getErrorMessage, getHeight, getHeightUnits, getInternalStyles, getLabel, getLocale, getPrimaryStyleName, getState, getState, getStyle, getStyleName, getTooltip, getWidth, getWidthUnits, hasClassName, isEnabled, isOrHasAncestor, isReadOnly, isRequiredIndicatorVisible, isResponsive, isVisible, notifyParentAboutStyleChanges, onEnabledStateChanged, removeClassName, removeClassNames, removeInternalStyles, removeStyleName, removeStyleNames, setClassName, setClassName, setComponentError, setData, setDescription, setDescription, setEnabled, setHeight, setHeightFull, setHeightUndefined, setIcon, setLabel, setLocale, setParent, setPrimaryStyleName, setReadOnly, setRequiredIndicatorVisible, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setTooltipText, setVisible, setWidth, setWidthFull, setWidthUndefinedMethods inherited from class com.vaadin.classic.v8.server.AbstractClientConnector
addExtension, addLegacyAttachListener, addLegacyDetachListener, addListener, addListener, addMethodInvocationToQueue, attach, createState, detach, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getResource, getSession, handleConnectorRequest, hasListeners, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, onDetach, registerRpc, registerRpc, removeExtension, setErrorHandler, setResource, updateDiffstateMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setIdMethods 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.HasElement
getElementMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Panel
public Panel()Creates a new empty panel. -
Panel
public Panel(com.vaadin.flow.component.Component content) Creates a new empty panel which contains the given content.- Parameters:
content- the content for the panel.
-
Panel
Creates a new empty panel with caption.- Parameters:
caption- the caption used in the panel (HTML).
-
Panel
Creates a new empty panel with the given caption and content.- Parameters:
caption- the caption of the panel (HTML).content- the content used in the panel.
-
-
Method Details
-
beforeClientResponse
public void beforeClientResponse(boolean initial) Description copied from interface:ClientConnectorCalled before the response is written to client side. Gives the legacy connector an opportunity to set computed/dynamic state values.This is implemented for the legacy components to keep consistent behavior and e.g. legaze size calculations working.
NOTE: the parameter
initialisfalsewhen the component is attached again to a newUIwhenPreserveOnRefreshis used.- Specified by:
beforeClientResponsein interfaceClientConnector- Overrides:
beforeClientResponsein classAbstractComponent- Parameters:
initial-trueif the client-side connector will be created and initialized after this method has been invoked.falseif there is already an initialized client-side connector.
-
addClickListener
Add a click listener to the Panel. The listener is called whenever the user clicks inside the Panel. Also, when the click targets a component inside the Panel, provided the targeted component does not prevent the click event from propagating.- Parameters:
listener- The listener to add, not null- Returns:
- a registration object for removing the listener
- See Also:
-
Registration
-
setCaption
Sets the caption of the component.A caption is an explanatory textual label accompanying a user interface component, usually shown above, left of, or inside the component.
Panel panel = new Panel(); panel.setCaption("Panel caption");The contents of a caption are automatically quoted, so no raw HTML can be rendered in a caption. The validity of the used character encoding, usually UTF-8, is not checked.
The caption is displayed inside the component.
- Overrides:
setCaptionin classAbstractComponent- Parameters:
caption- the new caption for the component. If the caption isnull, no caption is shown, and it does not normally take any space
-
getCaption
Gets the caption of the component.See
setCaption(String)for a detailed description of the caption.- Overrides:
getCaptionin classAbstractComponent- Returns:
- the caption of the component or
nullif the caption is not set. - See Also:
-
setCaptionAsHtml
public void setCaptionAsHtml(boolean captionAsHtml) Sets whether the caption is rendered as HTML.If set to true, the captions are rendered in the browser as HTML and the developer is responsible for ensuring no harmful HTML is used. If set to false, the caption is rendered in the browser as plain text.
Note: Unlike the Label component in Vaadin 7/8, the script tag is removed when the caption is rendered as html The default is false, i.e. to render that caption as plain text.
- Overrides:
setCaptionAsHtmlin classAbstractComponent- Parameters:
captionAsHtml- true if the captions are rendered as HTML, false if rendered as plain text
-
isCaptionAsHtml
public boolean isCaptionAsHtml()Checks whether captions are rendered as HTMLThe default is false, i.e. to render that caption as plain text.
- Overrides:
isCaptionAsHtmlin classAbstractComponent- Returns:
- true if the captions are rendered as HTML, false if rendered as plain text
-
setIcon
public void setIcon(com.vaadin.flow.component.icon.Icon icon) Sets the icon of the component.An icon is an explanatory graphical label accompanying a user interface component, usually shown above, left of, or inside the component. Icon is closely related to caption (see
setCaption()) and is displayed horizontally before..// Component with an icon from a custom theme Panel panel = new Panel("Name"); panel.setIcon(VaadinIcon.COPY.create()); layout.addComponent(name);An icon will be rendered inside an HTML element that has the
v-iconCSS style class. The containing layout may enclose an icon and a caption inside elements related to the caption, such asv-caption.- Parameters:
icon- the icon of the component. If null, no icon is shown, and it does not normally take any space.- See Also:
-
getIcon
Non-op method.
In order to get the icon set with
setIcon(Icon), usegetIconAsIcon()- Overrides:
getIconin classAbstractComponent- Returns:
- fake resource
- See Also:
-
getIconAsIcon
public com.vaadin.flow.component.icon.Icon getIconAsIcon()Gets the icon resource of the component.See
setIcon(Icon)for a detailed description of the icon.- Returns:
- the icon component or
nullif the component has no icon - See Also:
-
getScrollLeft
public int getScrollLeft()Gets scroll left offset.Scrolling offset is the number of pixels this scrollable has been scrolled right.
- Returns:
- Horizontal scrolling position in pixels.
-
setScrollLeft
public void setScrollLeft(int scrollLeft) Sets scroll left offset.Scrolling offset is the number of pixels this scrollable has been scrolled right.
- Parameters:
scrollLeft- the xOffset.
-
getScrollTop
public int getScrollTop()Gets scroll top offset.Scrolling offset is the number of pixels this scrollable has been scrolled down.
- Returns:
- Vertical scrolling position in pixels.
-
setScrollTop
public void setScrollTop(int scrollTop) Sets scroll top offset.Scrolling offset is the number of pixels this scrollable has been scrolled down.
The scrolling position is limited by the current height of the content area. If the position is below the height, it is scrolled to the bottom. However, if the same response also adds height to the content area, scrolling to bottom only scrolls to the bottom of the previous content area.
- Parameters:
scrollTop- the yOffset.
-
focus
public void focus()Description copied from class:AbstractComponentSets the focus for this component if the component isFocusable. NOTE: the focus is not set until the component is attached.- Specified by:
focusin interfaceFocusable- Overrides:
focusin classAbstractComponent
-
getTabIndex
public int getTabIndex()Description copied from interface:FocusableGets the tabulator index of theFocusablecomponent.- Specified by:
getTabIndexin interfaceFocusable- Returns:
- tab index set for the
Focusablecomponent - See Also:
-
setTabIndex
public void setTabIndex(int tabIndex) Description copied from interface:FocusableSets the tabulator index of theFocusablecomponent. The tab index property is used to specify the order in which the fields are focused when the user presses the Tab key. Components with a defined tab index are focused sequentially first, and then the components with no tab index.After all focusable user interface components are done, the browser can begin again from the component with the smallest tab index, or it can take the focus out of the page, for example, to the location bar.
If the tab index is not set (is set to zero), the default tab order is used. The order is somewhat browser-dependent, but generally follows the HTML structure of the page.
A negative value means that the component is completely removed from the tabulation order and can not be reached by pressing the Tab key at all.
- Specified by:
setTabIndexin interfaceFocusable- Parameters:
tabIndex- the tab order of this component. Indexes usually start from 1. Zero means that default tab order should be used. A negative value means that the field should not be included in the tabbing sequence.- See Also:
-
addAction
Deprecated.Description copied from interface:Action.NotifierNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Specified by:
addActionin interfaceAction.Notifier- Type Parameters:
T- type- Parameters:
action- action
-
removeAction
Deprecated.Description copied from interface:Action.NotifierNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Specified by:
removeActionin interfaceAction.Notifier- Type Parameters:
T- type- Parameters:
action- action
-
addActionHandler
Deprecated.Description copied from interface:Action.ContainerNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Specified by:
addActionHandlerin interfaceAction.Container- Parameters:
actionHandler- the new handler to be added.
-
removeActionHandler
Deprecated.Description copied from interface:Action.ContainerNot supported. See Classic Component Pack documentation in https://vaadin.com/docs/latest/flow/upgrading/legacy-component-pack for mitigation options.- Specified by:
removeActionHandlerin interfaceAction.Container- Parameters:
actionHandler- the handler to be removed.
-