Interface HasEnabled

All Superinterfaces:
HasElement, Serializable
All Known Subinterfaces:
FlexComponent, Focusable<T>, HasComponents, HasItemComponents<T>, HasItemsAndComponents<T>, HasOrderedComponents, HasValueAndElement<E,V>, MultiSelect<C,T>, SingleSelect<C,T>
All Known Implementing Classes:
AbstractCompositeField, AbstractField, AbstractLogin, AbstractNumberField, AbstractSinglePropertyField, AccordionPanel, Anchor, Article, Aside, BigDecimalField, Board, Button, Checkbox, CheckboxGroup, ComboBox, ComboBoxBase, ConfirmDialog, ContextMenu, ContextMenuBase, CrudGrid, CustomField, DatePicker, DateTimePicker, DescriptionList, DescriptionList.Description, DescriptionList.Term, Details, Dialog, Div, DrawerToggle, EmailField, Emphasis, FlexLayout, Footer, FormLayout, FormLayout.FormItem, Grid, GridContextMenu, GridMenuItem, GridPro, H1, H2, H3, H4, H5, H6, Header, HorizontalLayout, HtmlContainer, HtmlObject, Image, Input, IntegerField, Label, ListBox, ListBoxBase, ListItem, LoginForm, LoginOverlay, Main, MenuBar, MenuItem, MenuItemBase, MessageInput, MultiSelectComboBox, MultiSelectListBox, NativeButton, NativeDetails.Summary, NativeLabel, Nav, Notification, NumberField, OrderedList, Paragraph, PasswordField, Pre, RadioButtonGroup, RichTextEditor, RouterLink, Row, Section, Select, Span, Tab, Tabs, TextArea, TextField, TextFieldBase, TimePicker, TreeGrid, UI, UnorderedList, VerticalLayout, VirtualList, WebComponentUI

public interface HasEnabled extends HasElement
A generic interface for components and other user interface objects that may be enabled or disabled. The server will ignore incoming events for a disabled element unless the listener has been explicitly configured to allow events in a disabled state using e.g. DomListenerRegistration.setDisabledUpdateMode(DisabledUpdateMode).

Implementing classes should not define their own implementations of the methods defined in this interface since the framework's overall security capabilities are dependent on a correct implementation. Instead, the visual representation of a disabled component can be configured by overriding Component.onEnabledStateChanged(boolean).

An element may be implicitly or explicitly disabled.

  • It is explicitly disabled if it's disabled via the setEnabled(false) call.
  • It is implicitly disabled if it has an ascendant which is explicitly disabled.
An element is enabled if it's not explicitly disabled and there is no disabled ascendant.

An implicitly disabled element becomes enabled automatically if its disabled ascendant becomes enabled.

An element may be explicitly disabled when it is only implicitly disabled. Such element remains disabled when its ascendant becomes enabled.

Note that an element may change its enabled state if it's inside a disabled parent and it becomes detached from it. In this case if it has not been explicitly disabled then it becomes enabled until it's attached. If the new parent is enabled then the element remains enabled. Otherwise it becomes disabled again.

Since:
1.0
Author:
Vaadin Ltd
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Returns whether the object is enabled or disabled.
    default void
    setEnabled(boolean enabled)
    Sets the UI object explicitly disabled or enabled.

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement
  • Method Details

    • setEnabled

      default void setEnabled(boolean enabled)
      Sets the UI object explicitly disabled or enabled.
      Parameters:
      enabled - if false then explicitly disables the object, if true then enables the object so that its state depends on parent
    • isEnabled

      default boolean isEnabled()
      Returns whether the object is enabled or disabled.

      Object may be enabled by itself by but if its ascendant is disabled then it's considered as (implicitly) disabled.

      Returns:
      enabled state of the object