Interface IUIImage2Listener
An image the user picks is uploaded over HTTPS through the upload service of the client session, as soon as it passes the pixel check, and onImageSelection(UIImage2, String, ImageType, byte[], int, int, ImageOrientation, double, GRect, boolean) is called with its bytes once it has been received and verified. The upload events are default methods, so a listener overrides only what it needs; they are called on the application session's worker, as the upload service calls its listeners, and only while the component lives. A server that does not allow uploads ($upload.allow) receives the image over the WebSocket as before, and then no upload event is called.
- Author:
- Christopher Mindus
Method Summary
Modifier and TypeMethodDescriptiondefault voidonFileCancelled(UIImage2 image, IUploadFile file, String reason) Invoked once when the upload of the image file was cancelled: by the user picking another image (user), by the value of the component being replaced from the server during the upload (replaced), by the disposal of the component (disposed), or by a timeout of the upload service (idle,start,maxPause);onImageSelection(UIImage2, String, ImageType, byte[], int, int, ImageOrientation, double, GRect, boolean)is not invoked.default voidonFileFailed(UIImage2 image, IUploadFile file, String reason) Invoked once when the upload of the image file failed its transfer or its verification, e.g.default voidonFilePaused(UIImage2 image, IUploadFile file, String reason) Invoked once when the upload of the image file is paused, by the application or by the client (its page hidden, its network gone).default voidonFileProgress(UIImage2 image, IUploadFile file, long plainBytes, long plainTotal) Invoked as chunks of the image file arrive, at most once per second.default voidonFileResumed(UIImage2 image, IUploadFile file) Invoked once when a paused upload of the image file may continue.default voidonFileStarted(UIImage2 image, IUploadFile file) Invoked when the first chunk of the image file has been accepted by the server.voidonImageChanged(UIImage2 image, IImageTarget imageTarget) Change of image caused by the user selecting a new image (theimageTargetisnull), some programmatic call not directly caused by the user, but as a result of a user change at some earlier point in time, or that the VirtualSpace value was changed.voidonImageModified(UIImage2 image, ImageOrientation orientation, double zoom, GRect rect) Invoked when the image has been modified.voidonImageSelection(UIImage2 image, String name, ImageType type, byte[] data, int width, int height, ImageOrientation orientation, double zoom, GRect rect, boolean isCircle) Invoked when the user has selected an image.
Method Details
onImageSelection
void onImageSelection(UIImage2 image, String name, ImageType type, byte[] data, int width, int height, ImageOrientation orientation, double zoom, GRect rect, boolean isCircle) Invoked when the user has selected an image.- Parameters:
image- The image selection and upload property.name- The original file name on the client side.type- The image type.data- The original file data, uncropped.width- The original image in pixels.height- The original image height in pixels.orientation- The orientation.zoom- The zoom factor.rect- The cropping rectangle.isCircle- Flag indicating the image cropping is a circle iftrue, rectangle or square iffalse.
onImageModified
Invoked when the image has been modified.- Parameters:
image- The image selection and upload property.orientation- The orientation.zoom- The zoom.rect- The crop rectangle.
onImageChanged
Change of image caused by the user selecting a new image (theimageTargetisnull), some programmatic call not directly caused by the user, but as a result of a user change at some earlier point in time, or that the VirtualSpace value was changed.This method is not invoked when a user chooses a image, only e.g. programmatic changes when the
UIImage2property is updated with a URL from an image that has been stored, typically accessible from the web.- Parameters:
image- The image selection and upload property.imageTarget- The image target,nullif a user has selected an image and the server application has not yet processed the image selected to save e.g. as a profile image.
onFileStarted
Invoked when the first chunk of the image file has been accepted by the server.- Parameters:
image- The image selection and upload property.file- The file being uploaded.
onFileProgress
Invoked as chunks of the image file arrive, at most once per second.- Parameters:
image- The image selection and upload property.file- The file being uploaded.plainBytes- The bytes received so far.plainTotal- The declared size of the file.
onFilePaused
Invoked once when the upload of the image file is paused, by the application or by the client (its page hidden, its network gone).- Parameters:
image- The image selection and upload property.file- The file being uploaded.reason- The reason whoever paused it gave, nevernull.
onFileResumed
Invoked once when a paused upload of the image file may continue.- Parameters:
image- The image selection and upload property.file- The file being uploaded.
onFileFailed
Invoked once when the upload of the image file failed its transfer or its verification, e.g. a file whose content is not the PNG or JPEG image it claims to be. The user is told by the client;onImageSelection(UIImage2, String, ImageType, byte[], int, int, ImageOrientation, double, GRect, boolean)is not invoked.- Parameters:
image- The image selection and upload property.file- The file.reason- The reason, e.g.typeMismatch,typeNotPermitted,sizeMismatch,corrupt.
onFileCancelled
Invoked once when the upload of the image file was cancelled: by the user picking another image (user), by the value of the component being replaced from the server during the upload (replaced), by the disposal of the component (disposed), or by a timeout of the upload service (idle,start,maxPause);onImageSelection(UIImage2, String, ImageType, byte[], int, int, ImageOrientation, double, GRect, boolean)is not invoked.- Parameters:
image- The image selection and upload property.file- The file.reason- The reason.