Package apple.uikit

Class NSTextContentManager

  • All Implemented Interfaces:
    NSCoding, NSSecureCoding, NSObject, NSTextElementProvider
    Direct Known Subclasses:
    NSTextContentStorage

    public class NSTextContentManager
    extends NSObject
    implements NSTextElementProvider, NSSecureCoding
    NSTextContentManager is an abstract class defining the interface for managing the text document contents and the default implementation. The concrete subclass overrides NSTextElementProvider for managing the content backing store. It is the root object strongly referencing the rest of objects in the TextKit network via an array of NSTextLayoutManager. Also, it manages the editing transaction by tracking the active NSTextLayoutManager focused to be editing. API-Since: 15.0
    • Constructor Detail

      • NSTextContentManager

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

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • addTextLayoutManager

        public void addTextLayoutManager​(@NotNull
                                         @NotNull NSTextLayoutManager textLayoutManager)
      • adjustedRangeFromRangeForEditingTextSelection

        @Nullable
        public @Nullable NSTextRange adjustedRangeFromRangeForEditingTextSelection​(@NotNull
                                                                                   @NotNull NSTextRange textRange,
                                                                                   boolean forEditingTextSelection)
        Description copied from interface: NSTextElementProvider
        Should be implemented if the location backing store requires manual adjustment after editing. When textRange is intersecting or following the current edited range, the method returns the range adjusted for the modification in the editing session. Returns nil, when no adjustment necessary. forEditingTextSelection indicates if textRange is for the text selection associated with the edit session.
        Specified by:
        adjustedRangeFromRangeForEditingTextSelection in interface NSTextElementProvider
      • allocWithZone

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

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

        public boolean automaticallySynchronizesTextLayoutManagers()
        Automatically synchronizes all text layout managers when hasEditingTransaction becoming NO. YES by default.
      • automaticallySynchronizesToBackingStore

        public boolean automaticallySynchronizesToBackingStore()
        Automatically synchronizes the backing store when hasEditingTransaction becoming NO. NO by default.
      • 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()
      • debugDescription_static

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

        @Nullable
        public @Nullable java.lang.Object delegate()
      • description_static

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

        @NotNull
        public @NotNull NSTextRange documentRange()
        Description copied from interface: NSTextElementProvider
        Declares the starting and ending locations for the document. The subclass could use its own implementation of a location object conforming to NSTextRange.
        Specified by:
        documentRange in interface NSTextElementProvider
      • enumerateTextElementsFromLocationOptionsUsingBlock

        @Nullable
        public @Nullable NSTextLocation enumerateTextElementsFromLocationOptionsUsingBlock​(@Nullable
                                                                                           @Nullable NSTextLocation textLocation,
                                                                                           long options,
                                                                                           @NotNull
                                                                                           NSTextElementProvider.Block_enumerateTextElementsFromLocationOptionsUsingBlock block)
        Description copied from interface: NSTextElementProvider
        Enumerates the text elements starting at textLocation. If textLocation=nil, it assumes self.documentRange.location for forward enumeration; uses self.documentRange.endLocation for reverse enumeration. When enumerating backward, it starts with the element preceding the one containing textLocation. If enumerated at least one element, it returns the edge of the enumerated range. Note that the enumerated range might not match the range of the last element returned. It enumerates the elements in the sequence, but it can skip a range (it can limit the maximum number of text elements enumerated for a single invocation or hide some elements from the layout). Returning NO from block breaks out of the enumeration.
        Specified by:
        enumerateTextElementsFromLocationOptionsUsingBlock in interface NSTextElementProvider
      • hasEditingTransaction

        public boolean hasEditingTransaction()
        When YES, there is an active editing transaction from primaryTextLayoutManager. the synchronization operations to non-primary text layout managers and the backing store block (or fails when synchronous) while this property is YES. Non-primary text layout managers should avoid accessing the elements while this is YES. KVO-compliant
      • 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)
      • locationFromLocationWithOffset

        @Nullable
        public @Nullable NSTextLocation locationFromLocationWithOffset​(@NotNull
                                                                       @NotNull NSTextLocation location,
                                                                       long offset)
        Description copied from interface: NSTextElementProvider
        Returns a new location from location with offset. The offset value could be positive or negative indicating the logical direction. Could return nil when the inputs don't produce any legal location (i.e. out of bounds index).
        Specified by:
        locationFromLocationWithOffset in interface NSTextElementProvider
      • offsetFromLocationToLocation

        public long offsetFromLocationToLocation​(@NotNull
                                                 @NotNull NSTextLocation from,
                                                 @NotNull
                                                 @NotNull NSTextLocation to)
        Description copied from interface: NSTextElementProvider
        Returns the offset between from and to. The return value could be positive or negative. Could return NSNotFound when the offset cannot be represented in an integer value (i.e. locations are not in the same document).
        Specified by:
        offsetFromLocationToLocation in interface NSTextElementProvider
      • performEditingTransactionUsingBlock

        public void performEditingTransactionUsingBlock​(@NotNull
                                                        @NotNull NSTextContentManager.Block_performEditingTransactionUsingBlock transaction)
        Invoked by primaryTextLayoutManager controlling the active editing transaction. Can be nested. The outer most transaction toggles hasEditingTransaction and sends synchronization messages if enabled after invoking transaction.
      • primaryTextLayoutManager

        @Nullable
        public @Nullable NSTextLayoutManager primaryTextLayoutManager()
        The primary NSTextLayoutManager interacting with the user allowing to edit. Setting an NSTextLayoutManager not in textLayoutManagers will reset to nil. It automatically synchronizes pending edits before switching to a new primary object. The operation is synchronous. KVO-compliant
      • recordEditActionInRangeNewTextRange

        public void recordEditActionInRangeNewTextRange​(@NotNull
                                                        @NotNull NSTextRange originalTextRange,
                                                        @NotNull
                                                        @NotNull NSTextRange newTextRange)
        Records information about an edit action to the transaction. originalTextRange is the range edited before the action, and newTextRange is the corresponding range after the action. The concrete subclass should invoke this method for each edit action.
      • removeTextLayoutManager

        public void removeTextLayoutManager​(@NotNull
                                            @NotNull NSTextLayoutManager textLayoutManager)
      • replaceContentsInRangeWithTextElements

        public void replaceContentsInRangeWithTextElements​(@NotNull
                                                           @NotNull NSTextRange range,
                                                           @Nullable
                                                           @Nullable NSArray<? extends NSTextElement> textElements)
        Description copied from interface: NSTextElementProvider
        Replaces the characters specified by range with textElements. If the edges of range is not at existing element range boundaries, it either split the element if it allows the operation (i.e. NSTextParagraph) or adjust the replacement range. This method is intended to be used only by NSTextLayoutManager.
        Specified by:
        replaceContentsInRangeWithTextElements in interface NSTextElementProvider
      • resolveClassMethod

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

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

        public void setAutomaticallySynchronizesTextLayoutManagers​(boolean value)
        Automatically synchronizes all text layout managers when hasEditingTransaction becoming NO. YES by default.
      • setAutomaticallySynchronizesToBackingStore

        public void setAutomaticallySynchronizesToBackingStore​(boolean value)
        Automatically synchronizes the backing store when hasEditingTransaction becoming NO. NO by default.
      • setDelegate_unsafe

        public void setDelegate_unsafe​(@Nullable
                                       @Nullable java.lang.Object value)
      • setDelegate

        public void setDelegate​(@Nullable
                                @Nullable java.lang.Object value)
      • setPrimaryTextLayoutManager

        public void setPrimaryTextLayoutManager​(@Nullable
                                                @Nullable NSTextLayoutManager value)
        The primary NSTextLayoutManager interacting with the user allowing to edit. Setting an NSTextLayoutManager not in textLayoutManagers will reset to nil. It automatically synchronizes pending edits before switching to a new primary object. The operation is synchronous. KVO-compliant
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

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

        public static boolean supportsSecureCoding()
      • _supportsSecureCoding

        public boolean _supportsSecureCoding()
        Description copied from interface: NSSecureCoding
        This property must return YES on all classes that allow secure coding. Subclasses of classes that adopt NSSecureCoding and override initWithCoder: must also override this method and return YES. The Secure Coding Guide should be consulted when writing methods that decode data.
        Specified by:
        _supportsSecureCoding in interface NSSecureCoding
      • synchronizeTextLayoutManagers

        public void synchronizeTextLayoutManagers​(@Nullable
                                                  @Nullable NSTextContentManager.Block_synchronizeTextLayoutManagers completionHandler)
        Synchronizes changes to all non-primary text layout managers. If completionHandler=nil, performs the operation synchronously. completionHandler gets passed error if failed. It should block (or fail if synchronous) when there is an active transaction.
      • textElementsForRange

        @NotNull
        public @NotNull NSArray<? extends NSTextElement> textElementsForRange​(@NotNull
                                                                              @NotNull NSTextRange range)
        Returns an array of NSTextElement intersecting the specified range in sequence. It can return a set of elements not filling the entire range specified if the entire range is not synchronously available. Uses -enumerateTextElementsFromLocation:options:usingBlock: to fill the array.
      • textLayoutManagers

        @NotNull
        public @NotNull NSArray<? extends NSTextLayoutManager> textLayoutManagers()
        An array of NSTextLayoutManager. KVO-compliant
      • version_static

        public static long version_static()
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.