Class AbstractComponent
- All Implemented Interfaces:
ClientConnector,FAbstractClientConnector,FSizeable,Sizeable,FAbstractComponent,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
- Direct Known Subclasses:
AbstractComponentContainer,AbstractSingleComponentContainer,Label
Component interface in
framework 8.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.featurepack.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.DetachEvent, ClientConnector.DetachListenerNested classes/interfaces inherited from interface com.vaadin.featurepack.server.FAbstractClientConnector
FAbstractClientConnector.LegacyMethodEventNested classes/interfaces inherited from interface com.vaadin.featurepack.ui.FAbstractComponent
FAbstractComponent.DataKey -
Field Summary
Fields inherited from interface com.vaadin.featurepack.server.Sizeable
SIZE_UNDEFINED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClassName(String className) voidaddClassNames(String... classNames) protected voidaddInternalStyles(String... internalStyles) Adds given style names as "internal" which means that those will not be prefixed with the primary style name like user added style names are.voidbeforeClientResponse(boolean initial) Called before the response is written to client side.protected voiddoSetHeight(SizeWithUnit height) Internal method for reacting to height changes.protected voiddoSetWidth(SizeWithUnit width) Internal method for reacting to width changes.protected voidEmits the component event.protected voidfireEvent(com.vaadin.flow.component.ComponentEvent<?> componentEvent) protected voidfocus()Sets the focus for this component if the component isFocusable.com.vaadin.flow.dom.ClassListprotected Collection<String> Returns the user added custom style names in an unmodifiable collection.floatGets the height of the object.com.vaadin.flow.component.UnitGets the height property units.protected Collection<String> Returns the internal styles in an unmodifiable collection.Get the locale from the current component or UI or from the given I18NProvider. -> If UI is not null, then it is used to get the locale, -> if UI is null, then the I18NProvider providedLocales first match will be returned, -> if I18NProvider is null, then default locale is returned.com.vaadin.flow.dom.StylegetStyle()com.vaadin.flow.component.shared.TooltipfloatgetWidth()Gets the width of the object.com.vaadin.flow.component.UnitGets the width property units.booleanhasClassName(String className) protected booleanisOrHasAncestor(com.vaadin.flow.component.Component content) Determine whether acontentcomponent is equal to, or the ancestor of this component.booleanGets the component visibility value.voidonEnabledStateChanged(boolean enabled) booleanremoveClassName(String className) voidremoveClassNames(String... classNames) protected voidremoveInternalStyles(String... internalStyles) Removes the given internal styles.voidsetClassName(String className) voidsetClassName(String className, boolean set) voidsetHeight(float height, com.vaadin.flow.component.Unit unit) Sets the height of the object.voidSets the height of the component using String presentation.voidSets the height to 100%.voidClears any defined height.voidsetParent(HasComponents parent) Sets the parent classic component of the component.voidSets the size to 100% x 100%.voidClears any size settings.com.vaadin.flow.component.shared.TooltipsetTooltipText(String text) voidsetVisible(boolean visible) Sets the component visibility value.voidsetWidth(float width, com.vaadin.flow.component.Unit unit) Sets the width of the object.voidSets the width of the component using String presentation.voidSets the width to 100%.voidClears any defined width.Methods inherited from class com.vaadin.featurepack.server.AbstractClientConnector
getSession, onAttach, onDetachMethods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, findAncestor, from, get, getChildren, getElement, getEventBus, getId, getListeners, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, getUIOrThrow, hasListener, isAttached, isTemplateMapped, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, whenAttachedMethods 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.featurepack.server.FAbstractClientConnector
addLegacyAttachListener, addLegacyDetachListener, addListener, addListener, attach, detach, doConnectorOnAttach, doConnectorOnDetach, fireEvent, fireEvent, getAllChildrenIterable, getFListeners, getFlowComponent, getResource, hasListeners, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeListener, removeListener, setResourceMethods inherited from interface com.vaadin.featurepack.ui.FAbstractComponent
addContextClickListener, addListener, addShortcutListener, addStyleName, addStyleNames, getCaption, getComponentError, getData, getDescription, getFErrorIndicator, getFErrorMessage, getFId, getFParent, getIcon, getIconResource, getPrimaryStyleName, getStyleName, isCaptionAsHtml, isImmediate, isResponsive, notifyParentAboutStyleChanges, removeContextClickListener, removeShortcutListener, removeStyleName, removeStyleNames, setCaption, setCaptionAsHtml, setComponentError, setData, setDescription, setDescription, setIcon, setIcon, setIconResource, setImmediate, setLabelComponent, setLocale, setPrimaryStyleName, setResponsive, setStyleName, setStyleNameMethods inherited from interface com.vaadin.featurepack.server.FSizeable
getFHeight, getFWidthMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
bindEnabled, isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasLabel
getLabel, setLabelMethods inherited from interface com.vaadin.flow.component.HasStyle
bindClassName, bindClassNamesMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
setTooltipMarkdown
-
Constructor Details
-
AbstractComponent
public AbstractComponent()
-
-
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- Specified by:
beforeClientResponsein interfaceFAbstractClientConnector- Specified by:
beforeClientResponsein interfaceFAbstractComponent- 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.
-
setParent
Sets the parent classic component of the component. The role of this method is to just make sure the old parent is flagged as dirty so that changes are applied (e.g. to sizing).- Parameters:
parent- the parent connector- Throws:
IllegalStateException- if a parent is given even though the connector already has a parent
-
fireComponentEvent
protected void fireComponentEvent()Emits the component event. It is transmitted to all registered listeners interested in such events. -
focus
protected void focus()Sets the focus for this component if the component isFocusable. NOTE: the focus is not set until the component is attached. -
isOrHasAncestor
protected boolean isOrHasAncestor(com.vaadin.flow.component.Component content) Determine whether acontentcomponent is equal to, or the ancestor of this component.- Parameters:
content- the potential ancestor element- Returns:
trueif the relationship holds
-
setWidth
public void setWidth(float width, com.vaadin.flow.component.Unit unit) Description copied from interface:SizeableSets the width of the object. Negative number implies unspecified size (terminal is free to set the size). -
setHeight
public void setHeight(float height, com.vaadin.flow.component.Unit unit) Description copied from interface:SizeableSets the height of the object. Negative number implies unspecified size (terminal is free to set the size). -
setWidth
Description copied from interface:SizeableSets the width of the component using String presentation.String presentation is similar to what is used in Cascading Style Sheets. Size can be length or percentage of available size.
The empty string ("") or null will unset the width and set the units to pixels.
See CSS specification for more details.
-
setSizeFull
public void setSizeFull()Description copied from interface:SizeableSets the size to 100% x 100%.- Specified by:
setSizeFullin interfaceFSizeable- Specified by:
setSizeFullin interfaceSizeable
-
setWidthFull
public void setWidthFull()Description copied from interface:SizeableSets the width to 100%.- Specified by:
setWidthFullin interfaceFSizeable- Specified by:
setWidthFullin interfaceSizeable
-
setHeightFull
public void setHeightFull()Description copied from interface:SizeableSets the height to 100%.- Specified by:
setHeightFullin interfaceFSizeable- Specified by:
setHeightFullin interfaceSizeable
-
setSizeUndefined
public void setSizeUndefined()Description copied from interface:SizeableClears any size settings.- Specified by:
setSizeUndefinedin interfaceFSizeable- Specified by:
setSizeUndefinedin interfaceSizeable
-
setWidthUndefined
public void setWidthUndefined()Description copied from interface:SizeableClears any defined width.- Specified by:
setWidthUndefinedin interfaceFSizeable- Specified by:
setWidthUndefinedin interfaceSizeable
-
setHeightUndefined
public void setHeightUndefined()Description copied from interface:SizeableClears any defined height.- Specified by:
setHeightUndefinedin interfaceFSizeable- Specified by:
setHeightUndefinedin interfaceSizeable
-
getWidth
public float getWidth()Description copied from interface:SizeableGets the width of the object. Negative number implies unspecified size (terminal is free to set the size). -
getHeight
public float getHeight()Description copied from interface:SizeableGets the height of the object. Negative number implies unspecified size (terminal is free to set the size). -
getWidthUnits
public com.vaadin.flow.component.Unit getWidthUnits()Description copied from interface:SizeableGets the width property units.- Specified by:
getWidthUnitsin interfaceFSizeable- Specified by:
getWidthUnitsin interfaceSizeable- Returns:
- units used in width property.
-
getHeightUnits
public com.vaadin.flow.component.Unit getHeightUnits()Description copied from interface:SizeableGets the height property units.- Specified by:
getHeightUnitsin interfaceFSizeable- Specified by:
getHeightUnitsin interfaceSizeable- Returns:
- units used in height property.
-
setHeight
Description copied from interface:SizeableSets the height of the component using String presentation.String presentation is similar to what is used in Cascading Style Sheets. Size can be length or percentage of available size.
The empty string ("") or null will unset the height and set the units to pixels.
See CSS specification for more details.
-
doSetWidth
Internal method for reacting to width changes.- Parameters:
width- the changed width to set
-
doSetHeight
Internal method for reacting to height changes.- Parameters:
height- the changed height to set
-
addInternalStyles
Adds given style names as "internal" which means that those will not be prefixed with the primary style name like user added style names are. In legacy framework these were handled by the client side connectors/widgets.- Parameters:
internalStyles- internal styles to add, notnull
-
removeInternalStyles
Removes the given internal styles.- Parameters:
internalStyles- the internal styles to remove
-
getInternalStyles
Returns the internal styles in an unmodifiable collection.- Returns:
- the internal styles of the component
- See Also:
-
getCustomStyles
Returns the user added custom style names in an unmodifiable collection.- Returns:
- the user added custom style names
-
onEnabledStateChanged
public void onEnabledStateChanged(boolean enabled) - Overrides:
onEnabledStateChangedin classcom.vaadin.flow.component.Component
-
getLocale
Get the locale from the current component or UI or from the given I18NProvider. -> If UI is not null, then it is used to get the locale, -> if UI is null, then the I18NProvider providedLocales first match will be returned, -> if I18NProvider is null, then default locale is returned.- Overrides:
getLocalein classcom.vaadin.flow.component.Component- Returns:
- Locale of this component or
nullif the component and none of its parents has a locale set and the component is not yet attached to an application.
-
isVisible
public boolean isVisible()Gets the component visibility value.Note: Although semantically the same, unlike Vaadin framework version 7/8 when a component is not visible, it is not removed from the DOM.
- Overrides:
isVisiblein classcom.vaadin.flow.component.Component- Returns:
trueif the component is visible,falseotherwise- See Also:
-
setVisible
public void setVisible(boolean visible) Sets the component visibility value.When a component is set as invisible, all the updates of the component from the server to the client are blocked until the component is set as visible again.
Invisible components don't receive any updates from the client-side. Unlike the server-side updates, client-side updates, if any, are discarded while the component is invisible, and are not transmitted to the server when the component is made visible.
Note: Although semantically the same, unlike Vaadin framework version 7/8 when a component is not visible, it is not removed from the DOM.
- Overrides:
setVisiblein classcom.vaadin.flow.component.Component- Parameters:
visible- the component visibility value- See Also:
-
setTooltipText
- Specified by:
setTooltipTextin interfacecom.vaadin.flow.component.shared.HasTooltip
-
getTooltip
public com.vaadin.flow.component.shared.Tooltip getTooltip()- Specified by:
getTooltipin interfacecom.vaadin.flow.component.shared.HasTooltip
-
addClassName
- Specified by:
addClassNamein interfacecom.vaadin.flow.component.HasStyle
-
removeClassName
- Specified by:
removeClassNamein interfacecom.vaadin.flow.component.HasStyle
-
setClassName
- Specified by:
setClassNamein interfacecom.vaadin.flow.component.HasStyle
-
getClassName
- Specified by:
getClassNamein interfacecom.vaadin.flow.component.HasStyle
-
getClassNames
public com.vaadin.flow.dom.ClassList getClassNames()- Specified by:
getClassNamesin interfacecom.vaadin.flow.component.HasStyle
-
setClassName
- Specified by:
setClassNamein interfacecom.vaadin.flow.component.HasStyle
-
hasClassName
- Specified by:
hasClassNamein interfacecom.vaadin.flow.component.HasStyle
-
getStyle
public com.vaadin.flow.dom.Style getStyle()- Specified by:
getStylein interfacecom.vaadin.flow.component.HasStyle
-
addClassNames
- Specified by:
addClassNamesin interfacecom.vaadin.flow.component.HasStyle
-
removeClassNames
- Specified by:
removeClassNamesin interfacecom.vaadin.flow.component.HasStyle
-
fireEvent
protected void fireEvent(com.vaadin.flow.component.ComponentEvent<?> componentEvent) - Overrides:
fireEventin classcom.vaadin.flow.component.Component
-