Class NSProgress

  • All Implemented Interfaces:
    NSObject

    public class NSProgress
    extends NSObject
    API-Since: 7.0
    • Constructor Detail

      • NSProgress

        protected NSProgress​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static NSProgress allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(@NotNull
                                                                   @NotNull java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(@NotNull
                                                                   @NotNull java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(@NotNull
                                                                                 @NotNull java.lang.Object aTarget,
                                                                                 @NotNull
                                                                                 @NotNull org.moe.natj.objc.SEL aSelector,
                                                                                 @Nullable
                                                                                 @Nullable java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        @NotNull
        public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        @NotNull
        public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
      • currentProgress

        @Nullable
        public static @Nullable NSProgress currentProgress()
        The instance of NSProgress associated with the current thread by a previous invocation of -becomeCurrentWithPendingUnitCount:, if any. The purpose of this per-thread value is to allow code that does work to usefully report progress even when it is widely separated from the code that actually presents progress to the user, without requiring layers of intervening code to pass the instance of NSProgress through. Using the result of invoking this directly will often not be the right thing to do, because the invoking code will often not even know what units of work the current progress object deals in. Invoking +progressWithTotalUnitCount: to create a child NSProgress object and then using that to report progress makes more sense in that situation.
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • discreteProgressWithTotalUnitCount

        @NotNull
        public static @NotNull NSProgress discreteProgressWithTotalUnitCount​(long unitCount)
        Return an instance of NSProgress that has been initialized with -initWithParent:userInfo:. The initializer is passed nil for the parent, resulting in a progress object that is not part of an existing progress tree. The value of the totalUnitCount property is also set. API-Since: 9.0
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        @NotNull
        public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(@NotNull
                                                                                             @NotNull java.lang.String key)
      • progressWithTotalUnitCount

        @NotNull
        public static @NotNull NSProgress progressWithTotalUnitCount​(long unitCount)
        Return an instance of NSProgress that has been initialized with -initWithParent:userInfo:. The initializer is passed the current progress object, if there is one, and the value of the totalUnitCount property is set. In many cases you can simply precede code that does a substantial amount of work with an invocation of this method, with repeated invocations of -setCompletedUnitCount: and -isCancelled in the loop that does the work. You can invoke this method on one thread and then message the returned NSProgress on another thread. For example, you can let the result of invoking this method get captured by a block passed to dispatch_async(). In that block you can invoke methods like -becomeCurrentWithPendingUnitCount: and -resignCurrent, or -setCompletedUnitCount: and -isCancelled.
      • progressWithTotalUnitCountParentPendingUnitCount

        @NotNull
        public static @NotNull NSProgress progressWithTotalUnitCountParentPendingUnitCount​(long unitCount,
                                                                                           @NotNull
                                                                                           @NotNull NSProgress parent,
                                                                                           long portionOfParentTotalUnitCount)
        Return an instance of NSProgress that has been attached to a parent progress with the given pending unit count. API-Since: 9.0
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • addChildWithPendingUnitCount

        public void addChildWithPendingUnitCount​(@NotNull
                                                 @NotNull NSProgress child,
                                                 long inUnitCount)
        Directly add a child progress to the receiver, assigning it a portion of the receiver's total unit count. API-Since: 9.0
      • becomeCurrentWithPendingUnitCount

        public void becomeCurrentWithPendingUnitCount​(long unitCount)
        Make the receiver the current thread's current progress object, returned by +currentProgress. At the same time, record how large a portion of the work represented by the receiver will be represented by the next progress object initialized by invoking -initWithParent:userInfo: in the current thread with the receiver as the parent. This will be used when that child is sent -setCompletedUnitCount: and the receiver is notified of that. With this mechanism, code that doesn't know anything about its callers can report progress accurately by using +progressWithTotalUnitCount: and -setCompletedUnitCount:. The calling code will account for the fact that the work done is only a portion of the work to be done as part of a larger operation. The unit of work in a call to -becomeCurrentWithPendingUnitCount: has to be the same unit of work as that used for the value of the totalUnitCount property, but the unit of work used by the child can be a completely different one, and often will be. You must always balance invocations of this method with invocations of -resignCurrent.
      • cancel

        public void cancel()
        Invoke the block registered with the cancellationHandler property, if there is one, and set the cancelled property to YES. Do this for the receiver, any descendants of the receiver, the instance of NSProgress that was published in another process to make the receiver if that's the case, and any descendants of such a published instance of NSProgress.
      • cancellationHandler

        @Nullable
        public @Nullable NSProgress.Block_cancellationHandler_ret cancellationHandler()
        A block to be invoked when cancel is invoked. The block will be invoked even when the method is invoked on an ancestor of the receiver, or an instance of NSProgress in another process that resulted from publishing the receiver or an ancestor of the receiver. Your block won't be invoked on any particular queue. If it must do work on a specific queue then it should schedule that work on that queue.
      • completedUnitCount

        public long completedUnitCount()
      • fractionCompleted

        public double fractionCompleted()
        The fraction of the overall work completed by this progress object, including work done by any children it may have.
      • initWithParentUserInfo

        public NSProgress initWithParentUserInfo​(@Nullable
                                                 @Nullable NSProgress parentProgressOrNil,
                                                 @Nullable
                                                 @Nullable NSDictionary<java.lang.String,​?> userInfoOrNil)
        The designated initializer. If a parent NSProgress object is passed then progress reporting and cancellation checking done by the receiver will notify or consult the parent. The only valid arguments to the first argument of this method are nil (indicating no parent) or [NSProgress currentProgress]. Any other value will throw an exception.
      • isCancellable

        public boolean isCancellable()
        Whether the work being done can be cancelled or paused, respectively. By default NSProgresses are cancellable but not pausable. NSProgress is by default KVO-compliant for these properties, with the notifications always being sent on the thread which updates the property. These properties are for communicating whether controls for cancelling and pausing should appear in a progress reporting user interface. NSProgress itself does not do anything with these properties other than help pass their values from progress reporters to progress observers. It is valid for the values of these properties to change in virtually any way during the lifetime of an NSProgress. Of course, if an NSProgress is cancellable you should actually implement cancellability by setting a cancellation handler or by making your code poll the result of invoking -isCancelled. Likewise for pausability.
      • setCancellable

        public void setCancellable​(boolean value)
        Whether the work being done can be cancelled or paused, respectively. By default NSProgresses are cancellable but not pausable. NSProgress is by default KVO-compliant for these properties, with the notifications always being sent on the thread which updates the property. These properties are for communicating whether controls for cancelling and pausing should appear in a progress reporting user interface. NSProgress itself does not do anything with these properties other than help pass their values from progress reporters to progress observers. It is valid for the values of these properties to change in virtually any way during the lifetime of an NSProgress. Of course, if an NSProgress is cancellable you should actually implement cancellability by setting a cancellation handler or by making your code poll the result of invoking -isCancelled. Likewise for pausability.
      • isCancelled

        public boolean isCancelled()
        Whether the work being done has been cancelled or paused, respectively. NSProgress is by default KVO-compliant for these properties, with the notifications always being sent on the thread which updates the property. Instances of NSProgress that have parents are at least as cancelled or paused as their parents.
      • isIndeterminate

        public boolean isIndeterminate()
        Whether the progress being made is indeterminate. -isIndeterminate returns YES when the value of the totalUnitCount or completedUnitCount property is less than zero. Zero values for both of those properties indicates that there turned out to not be any work to do after all; -isIndeterminate returns NO and -fractionCompleted returns 1.0 in that case. NSProgress is by default KVO-compliant for these properties, with the notifications always being sent on the thread which updates the property.
      • isPausable

        public boolean isPausable()
      • setPausable

        public void setPausable​(boolean value)
      • isPaused

        public boolean isPaused()
      • kind

        @Nullable
        public @Nullable java.lang.String kind()
        Either a string identifying what kind of progress is being made, like NSProgressKindFile, or nil. If the value of the localizedDescription property has not been set to a non-nil value then the default implementation of -localizedDescription uses the progress kind to determine how to use the values of other properties, as well as values in the user info dictionary, to create a string that is presentable to the user. This is most useful when -localizedDescription is actually being invoked in another process, whose localization language may be different, as a result of using the publish and subscribe mechanism described here.
      • localizedAdditionalDescription

        public java.lang.String localizedAdditionalDescription()
        A more specific description of what progress is being made, fit to present to the user. NSProgress is by default KVO-compliant for this property, with the notifications always being sent on thread which updates the property. The default implementation of the getter for this property does not always return the most recently set value of the property. If the most recently set value of this property is nil then NSProgress uses the value of the kind property to determine how to use the values of other properties, as well as values in the user info dictionary, to return a computed string. If it fails to do that then it returns an empty string. The difference between this and localizedDescription is that this text is meant to be more specific about what work is being done at any particular moment. For example, depending on the kind of progress, the completed and total unit counts, and other parameters, these kinds of strings may be generated: 3 of 10 files 123 KB of 789.1 MB 3.3 MB of 103.92 GB — 2 minutes remaining 1.61 GB of 3.22 GB (2 KB/sec) — 2 minutes remaining 1 minute remaining (1 KB/sec)
      • localizedDescription

        public java.lang.String localizedDescription()
        A description of what progress is being made, fit to present to the user. NSProgress is by default KVO-compliant for this property, with the notifications always being sent on thread which updates the property. The default implementation of the getter for this property does not always return the most recently set value of the property. If the most recently set value of this property is nil then NSProgress uses the value of the kind property to determine how to use the values of other properties, as well as values in the user info dictionary, to return a computed string. If it fails to do that then it returns an empty string. For example, depending on the kind of progress, the completed and total unit counts, and other parameters, these kinds of strings may be generated: Copying 10 files… 30% completed Copying “TextEdit”…
      • pause

        public void pause()
        Invoke the block registered with the pausingHandler property, if there is one, and set the paused property to YES. Do this for the receiver, any descendants of the receiver, the instance of NSProgress that was published in another process to make the receiver if that's the case, and any descendants of such a published instance of NSProgress.
      • pausingHandler

        @Nullable
        public @Nullable NSProgress.Block_pausingHandler_ret pausingHandler()
        A block to be invoked when pause is invoked. The block will be invoked even when the method is invoked on an ancestor of the receiver, or an instance of NSProgress in another process that resulted from publishing the receiver or an ancestor of the receiver. Your block won't be invoked on any particular queue. If it must do work on a specific queue then it should schedule that work on that queue.
      • resignCurrent

        public void resignCurrent()
        Balance the most recent previous invocation of -becomeCurrentWithPendingUnitCount: on the same thread by restoring the current progress object to what it was before -becomeCurrentWithPendingUnitCount: was invoked.
      • resume

        public void resume()
        Invoke the block registered with the resumingHandler property, if there is one, and set the paused property to NO. Do this for the receiver, any descendants of the receiver, the instance of NSProgress that was published in another process to make the receiver if that's the case, and any descendants of such a published instance of NSProgress. API-Since: 9.0
      • resumingHandler

        @Nullable
        public @Nullable NSProgress.Block_resumingHandler_ret resumingHandler()
        A block to be invoked when resume is invoked. The block will be invoked even when the method is invoked on an ancestor of the receiver, or an instance of NSProgress in another process that resulted from publishing the receiver or an ancestor of the receiver. Your block won't be invoked on any particular queue. If it must do work on a specific queue then it should schedule that work on that queue. API-Since: 9.0
      • setCancellationHandler

        public void setCancellationHandler​(@Nullable
                                           @Nullable NSProgress.Block_setCancellationHandler value)
        A block to be invoked when cancel is invoked. The block will be invoked even when the method is invoked on an ancestor of the receiver, or an instance of NSProgress in another process that resulted from publishing the receiver or an ancestor of the receiver. Your block won't be invoked on any particular queue. If it must do work on a specific queue then it should schedule that work on that queue.
      • setCompletedUnitCount

        public void setCompletedUnitCount​(long value)
      • setKind

        public void setKind​(@Nullable
                            @Nullable java.lang.String value)
        Either a string identifying what kind of progress is being made, like NSProgressKindFile, or nil. If the value of the localizedDescription property has not been set to a non-nil value then the default implementation of -localizedDescription uses the progress kind to determine how to use the values of other properties, as well as values in the user info dictionary, to create a string that is presentable to the user. This is most useful when -localizedDescription is actually being invoked in another process, whose localization language may be different, as a result of using the publish and subscribe mechanism described here.
      • setLocalizedAdditionalDescription

        public void setLocalizedAdditionalDescription​(java.lang.String value)
        A more specific description of what progress is being made, fit to present to the user. NSProgress is by default KVO-compliant for this property, with the notifications always being sent on thread which updates the property. The default implementation of the getter for this property does not always return the most recently set value of the property. If the most recently set value of this property is nil then NSProgress uses the value of the kind property to determine how to use the values of other properties, as well as values in the user info dictionary, to return a computed string. If it fails to do that then it returns an empty string. The difference between this and localizedDescription is that this text is meant to be more specific about what work is being done at any particular moment. For example, depending on the kind of progress, the completed and total unit counts, and other parameters, these kinds of strings may be generated: 3 of 10 files 123 KB of 789.1 MB 3.3 MB of 103.92 GB — 2 minutes remaining 1.61 GB of 3.22 GB (2 KB/sec) — 2 minutes remaining 1 minute remaining (1 KB/sec)
      • setLocalizedDescription

        public void setLocalizedDescription​(java.lang.String value)
        A description of what progress is being made, fit to present to the user. NSProgress is by default KVO-compliant for this property, with the notifications always being sent on thread which updates the property. The default implementation of the getter for this property does not always return the most recently set value of the property. If the most recently set value of this property is nil then NSProgress uses the value of the kind property to determine how to use the values of other properties, as well as values in the user info dictionary, to return a computed string. If it fails to do that then it returns an empty string. For example, depending on the kind of progress, the completed and total unit counts, and other parameters, these kinds of strings may be generated: Copying 10 files… 30% completed Copying “TextEdit”…
      • setPausingHandler

        public void setPausingHandler​(@Nullable
                                      @Nullable NSProgress.Block_setPausingHandler value)
        A block to be invoked when pause is invoked. The block will be invoked even when the method is invoked on an ancestor of the receiver, or an instance of NSProgress in another process that resulted from publishing the receiver or an ancestor of the receiver. Your block won't be invoked on any particular queue. If it must do work on a specific queue then it should schedule that work on that queue.
      • setResumingHandler

        public void setResumingHandler​(@Nullable
                                       @Nullable NSProgress.Block_setResumingHandler value)
        A block to be invoked when resume is invoked. The block will be invoked even when the method is invoked on an ancestor of the receiver, or an instance of NSProgress in another process that resulted from publishing the receiver or an ancestor of the receiver. Your block won't be invoked on any particular queue. If it must do work on a specific queue then it should schedule that work on that queue. API-Since: 9.0
      • setTotalUnitCount

        public void setTotalUnitCount​(long value)
        The size of the job whose progress is being reported, and how much of it has been completed so far, respectively. For an NSProgress with a kind of NSProgressKindFile, the unit of these properties is bytes while the NSProgressFileTotalCountKey and NSProgressFileCompletedCountKey keys in the userInfo dictionary are used for the overall count of files. For any other kind of NSProgress, the unit of measurement you use does not matter as long as you are consistent. The values may be reported to the user in the localizedDescription and localizedAdditionalDescription. If the receiver NSProgress object is a "leaf progress" (no children), then the fractionCompleted is generally completedUnitCount / totalUnitCount. If the receiver NSProgress has children, the fractionCompleted will reflect progress made in child objects in addition to its own completedUnitCount. As children finish, the completedUnitCount of the parent will be updated.
      • setUserInfoObjectForKey

        public void setUserInfoObjectForKey​(@Nullable
                                            @Nullable java.lang.Object objectOrNil,
                                            @NotNull
                                            @NotNull java.lang.String key)
        Set a value in the dictionary returned by invocations of -userInfo, with appropriate KVO notification for properties whose values can depend on values in the user info dictionary, like localizedDescription. If a nil value is passed then the dictionary entry is removed.
      • totalUnitCount

        public long totalUnitCount()
        The size of the job whose progress is being reported, and how much of it has been completed so far, respectively. For an NSProgress with a kind of NSProgressKindFile, the unit of these properties is bytes while the NSProgressFileTotalCountKey and NSProgressFileCompletedCountKey keys in the userInfo dictionary are used for the overall count of files. For any other kind of NSProgress, the unit of measurement you use does not matter as long as you are consistent. The values may be reported to the user in the localizedDescription and localizedAdditionalDescription. If the receiver NSProgress object is a "leaf progress" (no children), then the fractionCompleted is generally completedUnitCount / totalUnitCount. If the receiver NSProgress has children, the fractionCompleted will reflect progress made in child objects in addition to its own completedUnitCount. As children finish, the completedUnitCount of the parent will be updated.
      • userInfo

        @NotNull
        public @NotNull NSDictionary<java.lang.String,​?> userInfo()
        Arbitrary values associated with the receiver. Returns a KVO-compliant dictionary that changes as -setUserInfoObject:forKey: is sent to the receiver. The dictionary will send all of its KVO notifications on the thread which updates the property. The result will never be nil, but may be an empty dictionary. Some entries have meanings that are recognized by the NSProgress class itself. See the NSProgress...Key string constants listed below.
      • estimatedTimeRemaining

        @Nullable
        public @Nullable NSNumber estimatedTimeRemaining()
        How much time is probably left in the operation, as an NSNumber containing a number of seconds. This property is optional. If present, NSProgress will use the information to present more information in its localized description. This property sets a value in the userInfo dictionary. API-Since: 11.0
      • fileCompletedCount

        @Nullable
        public @Nullable NSNumber fileCompletedCount()
        If the progress is operating on a set of files, then set to the number of completed files in the operation. This property is optional. If present, NSProgress will use the information to present more information in its localized description. This property sets a value in the userInfo dictionary. API-Since: 11.0
      • fileOperationKind

        @Nullable
        public @Nullable java.lang.String fileOperationKind()
        When the kind property is NSProgressKindFile, this value should be set. It describes the kind of file operation being performed. If present, NSProgress will use the information to present more information in its localized description. This property sets a value in the userInfo dictionary. API-Since: 11.0
      • fileTotalCount

        @Nullable
        public @Nullable NSNumber fileTotalCount()
        If the progress is operating on a set of files, then set to the total number of files in the operation. This property is optional. If present, NSProgress will use the information to present more information in its localized description. This property sets a value in the userInfo dictionary. API-Since: 11.0
      • fileURL

        @Nullable
        public @Nullable NSURL fileURL()
        A URL identifying the item on which progress is being made. This is required for any NSProgress that is published using -publish to be reported to subscribers registered with +addSubscriberForFileURL:withPublishingHandler: If present, NSProgress will use the information to present more information in its localized description. This property sets a value in the userInfo dictionary. API-Since: 11.0
      • isFinished

        public boolean isFinished()
        True if the progress is considered finished. This property is observable.
      • setEstimatedTimeRemaining

        public void setEstimatedTimeRemaining​(@Nullable
                                              @Nullable NSNumber value)
        How much time is probably left in the operation, as an NSNumber containing a number of seconds. This property is optional. If present, NSProgress will use the information to present more information in its localized description. This property sets a value in the userInfo dictionary. API-Since: 11.0
      • setFileCompletedCount

        public void setFileCompletedCount​(@Nullable
                                          @Nullable NSNumber value)
        If the progress is operating on a set of files, then set to the number of completed files in the operation. This property is optional. If present, NSProgress will use the information to present more information in its localized description. This property sets a value in the userInfo dictionary. API-Since: 11.0
      • setFileOperationKind

        public void setFileOperationKind​(@Nullable
                                         @Nullable java.lang.String value)
        When the kind property is NSProgressKindFile, this value should be set. It describes the kind of file operation being performed. If present, NSProgress will use the information to present more information in its localized description. This property sets a value in the userInfo dictionary. API-Since: 11.0
      • setFileTotalCount

        public void setFileTotalCount​(@Nullable
                                      @Nullable NSNumber value)
        If the progress is operating on a set of files, then set to the total number of files in the operation. This property is optional. If present, NSProgress will use the information to present more information in its localized description. This property sets a value in the userInfo dictionary. API-Since: 11.0
      • setFileURL

        public void setFileURL​(@Nullable
                               @Nullable NSURL value)
        A URL identifying the item on which progress is being made. This is required for any NSProgress that is published using -publish to be reported to subscribers registered with +addSubscriberForFileURL:withPublishingHandler: If present, NSProgress will use the information to present more information in its localized description. This property sets a value in the userInfo dictionary. API-Since: 11.0
      • setThroughput

        public void setThroughput​(@Nullable
                                  @Nullable NSNumber value)
        How fast data is being processed, as an NSNumber containing bytes per second. This property is optional. If present, NSProgress will use the information to present more information in its localized description. This property sets a value in the userInfo dictionary. API-Since: 11.0
      • throughput

        @Nullable
        public @Nullable NSNumber throughput()
        How fast data is being processed, as an NSNumber containing bytes per second. This property is optional. If present, NSProgress will use the information to present more information in its localized description. This property sets a value in the userInfo dictionary. API-Since: 11.0
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.