Class DisableOnClickController<C extends Component & HasEnabled>
java.lang.Object
com.vaadin.flow.component.shared.internal.DisableOnClickController<C>
- Type Parameters:
 C- Type of the component that uses this controller.
- All Implemented Interfaces:
 Serializable
@JsModule("./disableOnClickFunctions.js")
public class DisableOnClickController<C extends Component & HasEnabled>
extends Object
implements Serializable
An internal controller for handling disabling a component when it is clicked.
 Not intended to be used publicly.
 
 When setDisableOnClick(boolean) is enabled, the component will be
 immediately disabled upon clicking, both on the client-side and server-side,
 to prevent multiple clicks or submissions while the server processes the
 event.
 
 This controller requires that the component implements HasEnabled.
- See Also:
 
- 
Constructor Summary
ConstructorsConstructorDescriptionDisableOnClickController(C component) Creates a new controller for the given component. - 
Method Summary
Modifier and TypeMethodDescriptionbooleanGets whether the component is set to be disabled when clicked.voidonSetEnabled(boolean enabled) Forces the client-side component'sdisabledproperty to be updated immediately.voidsetDisableOnClick(boolean disableOnClick) Sets whether the component should be disabled when clicked. 
- 
Constructor Details
- 
DisableOnClickController
Creates a new controller for the given component.- Parameters:
 component- the component to control, notnull
 
 - 
 - 
Method Details
- 
setDisableOnClick
public void setDisableOnClick(boolean disableOnClick) Sets whether the component should be disabled when clicked.When set to
true, the component will be immediately disabled on the client-side when clicked, preventing further clicks until re-enabled from the server-side.- Parameters:
 disableOnClick- whether the component should be disabled when clicked
 - 
isDisableOnClick
public boolean isDisableOnClick()Gets whether the component is set to be disabled when clicked.- Returns:
 - whether the component is set to be disabled on click
 
 - 
onSetEnabled
public void onSetEnabled(boolean enabled) Forces the client-side component'sdisabledproperty to be updated immediately.This method should be called from the component's
HasEnabled.setEnabled(boolean)method.- Parameters:
 enabled- value to set
 
 -