Class FileUpload

    • Constructor Detail

      • FileUpload

        public FileUpload()
        Constructs a new file upload widget.
      • FileUpload

        protected FileUpload​(Element element)
        This constructor may be used by subclasses to explicitly use an existing element. This element must be an <input> element whose type is 'file'.
        Parameters:
        element - the element to be used
    • Method Detail

      • wrap

        public static FileUpload wrap​(Element element)
        Creates a FileUpload widget that wraps an existing <input type='file'> element. This element must already be attached to the document. If the element is removed from the document, you must call RootPanel.detachNow(Widget).
        Parameters:
        element - the element to be wrapped
      • getFilename

        public java.lang.String getFilename()
        Gets the filename selected by the user. This property has no mutator, as browser security restrictions preclude setting it.
        Returns:
        the widget's filename
      • getName

        public java.lang.String getName()
        Description copied from interface: HasName
        Gets the widget's name.
        Specified by:
        getName in interface HasName
        Returns:
        the widget's name
      • isEnabled

        public boolean isEnabled()
        Gets whether this widget is enabled.
        Specified by:
        isEnabled in interface HasEnabled
        Overrides:
        isEnabled in class FocusWidget
        Returns:
        true if the widget is enabled
      • setEnabled

        public void setEnabled​(boolean enabled)
        Sets whether this widget is enabled.
        Specified by:
        setEnabled in interface HasEnabled
        Overrides:
        setEnabled in class FocusWidget
        Parameters:
        enabled - true to enable the widget, false to disable it
      • setName

        public void setName​(java.lang.String name)
        Description copied from interface: HasName
        Sets the widget's name.
        Specified by:
        setName in interface HasName
        Parameters:
        name - the widget's new name
      • click

        public void click()
        Programmatic equivalent of the user clicking the button, opening the file selection browser.

        NOTE: in certain browsers programmatic click is disabled if the element display is none, for instance in webkit you have to move the element off screen.