Package com.vaadin.flow.component.upload
Class UploadButton
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.button.Button
com.vaadin.flow.component.upload.UploadButton
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.button.Button>,com.vaadin.flow.component.ClickNotifier<com.vaadin.flow.component.button.Button>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.Focusable<com.vaadin.flow.component.button.Button>,com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.button.Button>,com.vaadin.flow.component.HasAriaLabel,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasText,com.vaadin.flow.component.HasTheme,com.vaadin.flow.component.shared.HasPrefix,com.vaadin.flow.component.shared.HasSuffix,com.vaadin.flow.component.shared.HasThemeVariant<com.vaadin.flow.component.button.ButtonVariant>,com.vaadin.flow.component.shared.HasTooltip,Serializable
@Tag("vaadin-upload-button")
@NpmPackage(value="@vaadin/upload",
version="25.1.0-beta1")
@JsModule("@vaadin/upload/src/vaadin-upload-button.js")
public class UploadButton
extends com.vaadin.flow.component.button.Button
A button component for triggering file uploads. When clicked, it opens a file
picker dialog. This component is designed to work with
UploadManager.
Example usage:
var manager = new UploadManager(uploadHandler);
var button = new UploadButton("Select Files", manager);
add(button);
- Author:
- Vaadin Ltd.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasText
com.vaadin.flow.component.HasText.WhiteSpace -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new upload button without a manager.UploadButton(UploadManager manager) Creates a new upload button linked to the given manager.UploadButton(String text, UploadManager manager) Creates a new upload button with the given text, linked to the given manager. -
Method Summary
Modifier and TypeMethodDescriptiondefault UploadManagerGets the upload manager that this component is linked to.voidsetEnabled(boolean enabled) Sets whether this button is enabled.default voidsetUploadManager(UploadManager manager) Sets the upload manager that this component is linked to.Methods inherited from class com.vaadin.flow.component.button.Button
addBlurListener, addFocusListener, addFocusShortcut, bindText, click, clickInClient, getIcon, getText, isAutofocus, isDisableOnClick, isIconAfterText, remove, setAutofocus, setDisableOnClick, setIcon, setIconAfterText, setTextMethods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods 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.ClickNotifier
addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
blur, focus, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.HasAriaLabel
getAriaLabel, getAriaLabelledBy, setAriaLabel, setAriaLabelledByMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
bindEnabled, isEnabledMethods inherited from interface com.vaadin.flow.component.shared.HasPrefix
getPrefixComponent, setPrefixComponentMethods inherited from interface com.vaadin.flow.component.HasSize
bindHeight, bindWidth, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.shared.HasSuffix
getSuffixComponent, setSuffixComponentMethods inherited from interface com.vaadin.flow.component.HasText
getWhiteSpace, setWhiteSpaceMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, bindThemeName, bindThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant
addThemeVariants, bindThemeVariant, removeThemeVariants, setThemeVariant, setThemeVariants, setThemeVariantsMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipMarkdown, setTooltipText
-
Field Details
-
ATTACH_LISTENER_REGISTRATION
- See Also:
-
CONNECTOR_ATTACH_LISTENER_REGISTRATION
- See Also:
-
-
Constructor Details
-
UploadButton
public UploadButton()Creates a new upload button without a manager. The manager must be set later usingsetUploadManager(UploadManager). -
UploadButton
Creates a new upload button linked to the given manager.- Parameters:
manager- the upload manager to link to, notnull- Throws:
NullPointerException- if manager isnull
-
UploadButton
Creates a new upload button with the given text, linked to the given manager.- Parameters:
text- the button textmanager- the upload manager to link to, notnull- Throws:
NullPointerException- if manager isnull
-
-
Method Details
-
setEnabled
public void setEnabled(boolean enabled) Sets whether this button is enabled. When disabled, the button cannot be used to select files.Note: Disabling this button only affects the UI and does not prevent a malicious client from initiating uploads. To securely prevent uploads, use
UploadManager.setEnabled(boolean).- Specified by:
setEnabledin interfacecom.vaadin.flow.component.HasEnabled- Overrides:
setEnabledin classcom.vaadin.flow.component.button.Button- Parameters:
enabled-trueto enable the button,falseto disable- See Also:
-
getUploadManager
Gets the upload manager that this component is linked to.- Returns:
- the upload manager, or
nullif not linked
-
setUploadManager
Sets the upload manager that this component is linked to.- Parameters:
manager- the upload manager, ornullto unlink
-