]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.eclipse.swt.win32.win32.x86_64/src/org/eclipse/swt/graphics/ImageLoaderEvent.java
64a9fbe02e796af186088d9c5e34af0d8bc01d7b
[simantics/platform.git] / bundles / org.eclipse.swt.win32.win32.x86_64 / src / org / eclipse / swt / graphics / ImageLoaderEvent.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2017 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.swt.graphics;
15
16
17 import java.util.*;
18
19 /**
20  * Instances of this class are sent as a result of the incremental
21  * loading of image data.
22  * <p>
23  * <b>Notes:</b>
24  * </p><ul>
25  * <li>The number of events which will be sent when loading images
26  * is not constant. It varies by image type, and for JPEG images it
27  * varies from image to image.</li>
28  * <li>For image sources which contain multiple images, the
29  * <code>endOfImage</code> flag in the event will be set to true
30  * after each individual image is loaded.</li>
31  * </ul>
32  *
33  * @see ImageLoader
34  * @see ImageLoaderListener
35  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
36  */
37
38 public class ImageLoaderEvent extends EventObject {
39
40         /**
41          * if the <code>endOfImage</code> flag is false, then this is a
42          * partially complete copy of the current <code>ImageData</code>,
43          * otherwise this is a completely loaded <code>ImageData</code>
44          */
45         public ImageData imageData;
46
47         /**
48          * the zero-based count of image data increments -- this is
49          * equivalent to the number of events that have been generated
50          * while loading a particular image
51          */
52         public int incrementCount;
53
54         /**
55          * If this flag is true, then the current image data has been
56          * completely loaded, otherwise the image data is only partially
57          * loaded, and further ImageLoader events will occur unless an
58          * exception is thrown
59          */
60         public boolean endOfImage;
61
62         static final long serialVersionUID = 3257284738325558065L;
63
64 /**
65  * Constructs a new instance of this class given the event source and
66  * the values to store in its fields.
67  *
68  * @param source the ImageLoader that was loading when the event occurred
69  * @param imageData the image data for the event
70  * @param incrementCount the image data increment for the event
71  * @param endOfImage the end of image flag for the event
72  */
73 public ImageLoaderEvent(ImageLoader source, ImageData imageData, int incrementCount, boolean endOfImage) {
74         super(source);
75         this.imageData = imageData;
76         this.incrementCount = incrementCount;
77         this.endOfImage = endOfImage;
78 }
79
80 /**
81  * Returns a string containing a concise, human-readable
82  * description of the receiver.
83  *
84  * @return a string representation of the event
85  */
86 @Override
87 public String toString () {
88         return "ImageLoaderEvent {source=" + source + " imageData=" + imageData + " incrementCount=" + incrementCount + " endOfImage=" + endOfImage + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
89 }
90
91 }