Class WFileDropWidget.File

java.lang.Object
eu.webtoolkit.jwt.WObject
eu.webtoolkit.jwt.WFileDropWidget.File
Direct Known Subclasses:
WFileDropWidget.Directory
Enclosing class:
WFileDropWidget

public static class WFileDropWidget.File extends WObject
A nested class of WFileDropWidget representing a file.

The methods returning the filename, mime-type and size return valid values if the upload of this file is not yet finished. The method getUploadedFile() is only available after the upload is finished.

  • Constructor Details

    • File

      public File(int id, String fileName, String path, String type, long size, long chunkSize)
  • Method Details

    • getClientFileName

      public String getClientFileName()
      Returns the client filename.
    • getPath

      public String getPath()
      Returns the path of the file.

      This is only relevant if the user dropped a folder. The path will be relative to the folder that was dropped.

    • isDirectory

      public boolean isDirectory()
      Returns whether this is a directory.
    • getMimeType

      public String getMimeType()
      Returns the mime-type of the file.
    • getSize

      public long getSize()
      Returns the size of the file.
    • getUploadedFile

      public UploadedFile getUploadedFile()
      Returns the uploaded file as a UploadedFile.

      This method will throw an expection if the upload is not yet finished.

      See Also:
    • isUploadFinished

      public boolean isUploadFinished()
      Returns true if the upload is finished.

      When this method returns true, the uploaded file is available on the server.

      See Also:
    • dataReceived

      public Signal2<Long,Long> dataReceived()
      This signal allows you to track the upload progress of the file.

      The first argument is the number of bytes received so far, and the second argument is the total number of bytes.

    • uploaded

      public Signal uploaded()
      This signal is triggered when the upload is finished.

      This is also signalled using the WFileDropWidget WFileDropWidget.uploaded() signal.

    • setFilterEnabled

      public void setFilterEnabled(boolean enabled)
    • isFilterEnabled

      public boolean isFilterEnabled()
    • isFiltered

      public boolean isFiltered()
    • handleIncomingData

      public void handleIncomingData(UploadedFile file, boolean last)
    • isCancelled

      public boolean isCancelled()
    • emitDataReceived

      public void emitDataReceived(long current, long total, boolean filterSupported)
    • setIsFiltered

      public void setIsFiltered(boolean filtered)