public interface HasEnabled extends HasElement
DomListenerRegistration.setDisabledUpdateMode(DisabledUpdateMode)
or
Element.addSynchronizedProperty(String, 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.
setEnabled(false)
call.
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.
Modifier and Type | Method and Description |
---|---|
default boolean |
isEnabled()
Returns whether the object is enabled or disabled.
|
default void |
setEnabled(boolean enabled)
Sets the UI object explicitly disabled or enabled.
|
getElement
default void setEnabled(boolean enabled)
enabled
- if false
then explicitly disables the object, if
true
then enables the object so that its state depends
on parentdefault boolean isEnabled()
Object may be enabled by itself by but if its ascendant is disabled then it's considered as (implicitly) disabled.
Copyright © 2023. All rights reserved.