Interface WebAPI.JSFile
- Enclosing class:
WebAPI
public static interface WebAPI.JSFile
-
Property Summary
PropertiesTypePropertyDescriptionjavafx.beans.property.ReadOnlyDoublePropertyDefines the progress of uploading the file.javafx.beans.property.ReadOnlyObjectProperty<File> Contains the file, which was uploaded.javafx.beans.property.ReadOnlyObjectProperty<WebAPI.UploadStatus> The state of the upload. -
Method Summary
Modifier and TypeMethodDescriptionvoidStops a running upload.longReturns the size of the file in bytes.Returns the Object URL representing the file.default doubleGets the value of the property progress.default FileGets the value of the property uploadedFile.This returns the file when the upload is finished.default WebAPI.UploadStatusGets the value of the property uploadStatus.javafx.beans.property.ReadOnlyDoublePropertyDefines the progress of uploading the file.javafx.beans.property.ReadOnlyObjectProperty<File> Contains the file, which was uploaded.voidStarts uploading the selected file.javafx.beans.property.ReadOnlyObjectProperty<WebAPI.UploadStatus> The state of the upload.
-
Property Details
-
progress
javafx.beans.property.ReadOnlyDoubleProperty progressPropertyDefines the progress of uploading the file. When the value is 1.0, then the upload is finished.- See Also:
-
uploadedFile
javafx.beans.property.ReadOnlyObjectProperty<File> uploadedFilePropertyContains the file, which was uploaded. It is null until progress reaches 1.0.- See Also:
-
uploadStatus
javafx.beans.property.ReadOnlyObjectProperty<WebAPI.UploadStatus> uploadStatusPropertyThe state of the upload. Progress is reset to 0 when the upload fails or is cancelled.- Since:
- 2026.3.2
- See Also:
-
-
Method Details
-
getFilename
String getFilename() -
getFileSize
long getFileSize()Returns the size of the file in bytes. -
getObjectURL
JSVariable getObjectURL()Returns the Object URL representing the file. The Object URL is only valid as long as the JSFile is not garbage collected. -
progressProperty
javafx.beans.property.ReadOnlyDoubleProperty progressProperty()Defines the progress of uploading the file. When the value is 1.0, then the upload is finished.- Returns:
- the
progressproperty - See Also:
-
uploadedFileProperty
javafx.beans.property.ReadOnlyObjectProperty<File> uploadedFileProperty()Contains the file, which was uploaded. It is null until progress reaches 1.0.- Returns:
- the
uploadedFileproperty - See Also:
-
getProgress
default double getProgress()Gets the value of the property progress. -
getUploadedFile
Gets the value of the property uploadedFile. -
uploadFile
void uploadFile()Starts uploading the selected file. During upload, the progress property will slowly reach 1.0. After a failed or cancelled upload, calling it again starts a new attempt. -
cancelUpload
void cancelUpload()Stops a running upload. The status becomesWebAPI.UploadStatus.CANCELLED, progress is reset to 0, the future fromgetUploadedFileFuture()is cancelled and nothing is kept on the server. Does nothing unless the status isWebAPI.UploadStatus.UPLOADING.- Since:
- 2026.3.2
-
uploadStatusProperty
javafx.beans.property.ReadOnlyObjectProperty<WebAPI.UploadStatus> uploadStatusProperty()The state of the upload. Progress is reset to 0 when the upload fails or is cancelled.- Returns:
- the
uploadStatusproperty - Since:
- 2026.3.2
- See Also:
-
getUploadStatus
Gets the value of the property uploadStatus.- Since:
- 2026.3.2
-
getUploadedFileFuture
CompletableFuture<File> getUploadedFileFuture()This returns the file when the upload is finished. Calling this method, will trigger the upload, if it hasn't started yet. The future completes exceptionally with anIOExceptionwhen the upload fails (for example when the server rejects the file) and is cancelled bycancelUpload(); cancelling the future stops the upload as well. After a failed or cancelled upload this returns that outcome; calluploadFile()to retry.- Returns:
- future of the uploaded file
-