All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bugvm.apple.uikit.NSAttributedStringDocumentAttributes Maven / Gradle / Ivy

/*
 * Copyright (C) 2013-2015 RoboVM AB
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bugvm.apple.uikit;

/**/
import java.io.*;
import java.nio.*;
import java.util.*;
import com.bugvm.objc.*;
import com.bugvm.objc.annotation.*;
import com.bugvm.objc.block.*;
import com.bugvm.rt.*;
import com.bugvm.rt.annotation.*;
import com.bugvm.rt.bro.*;
import com.bugvm.rt.bro.annotation.*;
import com.bugvm.rt.bro.ptr.*;
import com.bugvm.apple.foundation.*;
import com.bugvm.apple.coreanimation.*;
import com.bugvm.apple.coregraphics.*;
import com.bugvm.apple.coredata.*;
import com.bugvm.apple.coreimage.*;
import com.bugvm.apple.coretext.*;
import com.bugvm.apple.corelocation.*;
/**/

/**/
/**/
/**/@Library("UIKit")/**/
@Marshaler(/**/NSAttributedStringDocumentAttributes/**/.Marshaler.class)
/**/public/**/ class /**/NSAttributedStringDocumentAttributes/**/ 
    extends /**/NSDictionaryWrapper/**/
    /**//**/ {

    /**/
    public static class Marshaler {
        @MarshalsPointer
        public static NSAttributedStringDocumentAttributes toObject(Class cls, long handle, long flags) {
            NSDictionary o = (NSDictionary) NSObject.Marshaler.toObject(NSDictionary.class, handle, flags);
            if (o == null) {
                return null;
            }
            return new NSAttributedStringDocumentAttributes(o);
        }
        @MarshalsPointer
        public static long toNative(NSAttributedStringDocumentAttributes o, long flags) {
            if (o == null) {
                return 0L;
            }
            return NSObject.Marshaler.toNative(o.data, flags);
        }
    }
    public static class AsListMarshaler {
        @MarshalsPointer
        public static List toObject(Class cls, long handle, long flags) {
            NSArray o = (NSArray) NSObject.Marshaler.toObject(NSArray.class, handle, flags);
            if (o == null) {
                return null;
            }
            List list = new ArrayList<>();
            for (int i = 0; i < o.size(); i++) {
                list.add(new NSAttributedStringDocumentAttributes(o.get(i)));
            }
            return list;
        }
        @MarshalsPointer
        public static long toNative(List l, long flags) {
            if (l == null) {
                return 0L;
            }
            NSArray array = new NSMutableArray<>();
            for (NSAttributedStringDocumentAttributes i : l) {
                array.add(i.getDictionary());
            }
            return NSObject.Marshaler.toNative(array, flags);
        }
    }
    /**/

    /**/
    NSAttributedStringDocumentAttributes(NSDictionary data) {
        super(data);
    }
    public NSAttributedStringDocumentAttributes() {}
    /**/

    public boolean has(String key) {
        return data.containsKey(new NSString(key));
    }
    public NSObject get(String key) {
        if (has(key)) {
            return data.get(new NSString(key));
        }
        return null;
    }
    public NSAttributedStringDocumentAttributes set(String key, NSObject value) {
        data.put(new NSString(key), value);
        return this;
    }
    /**/
    public boolean has(NSAttributedStringDocumentAttribute key) {
        return data.containsKey(key.value());
    }
    public NSObject get(NSAttributedStringDocumentAttribute key) {
        if (has(key)) {
            return data.get(key.value());
        }
        return null;
    }
    public NSAttributedStringDocumentAttributes set(NSAttributedStringDocumentAttribute key, NSObject value) {
        data.put(key.value(), value);
        return this;
    }
    

    /**
     * @since Available in iOS 7.0 and later.
     */
    public NSDocumentType getDocumentType() {
        if (has(NSAttributedStringDocumentAttribute.DocumentType)) {
            NSString val = (NSString) get(NSAttributedStringDocumentAttribute.DocumentType);
            return NSDocumentType.valueOf(val);
        }
        return null;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public NSAttributedStringDocumentAttributes setDocumentType(NSDocumentType documentType) {
        set(NSAttributedStringDocumentAttribute.DocumentType, documentType.value());
        return this;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public NSStringEncoding getCharacterEncoding() {
        if (has(NSAttributedStringDocumentAttribute.CharacterEncoding)) {
            NSNumber val = (NSNumber) get(NSAttributedStringDocumentAttribute.CharacterEncoding);
            return NSStringEncoding.valueOf(val.longValue());
        }
        return null;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public NSAttributedStringDocumentAttributes setCharacterEncoding(NSStringEncoding characterEncoding) {
        set(NSAttributedStringDocumentAttribute.CharacterEncoding, NSNumber.valueOf(characterEncoding.value()));
        return this;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public NSAttributedStringAttributes getDefaultAttributes() {
        if (has(NSAttributedStringDocumentAttribute.DefaultAttributes)) {
            NSDictionary val = (NSDictionary) get(NSAttributedStringDocumentAttribute.DefaultAttributes);
            return new NSAttributedStringAttributes(val);
        }
        return null;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public NSAttributedStringDocumentAttributes setDefaultAttributes(NSAttributedStringAttributes defaultAttributes) {
        set(NSAttributedStringDocumentAttribute.DefaultAttributes, defaultAttributes.getDictionary());
        return this;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public CGSize getPaperSize() {
        if (has(NSAttributedStringDocumentAttribute.PaperSize)) {
            NSValue val = (NSValue) get(NSAttributedStringDocumentAttribute.PaperSize);
            return val.sizeValue();
        }
        return null;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public NSAttributedStringDocumentAttributes setPaperSize(CGSize paperSize) {
        set(NSAttributedStringDocumentAttribute.PaperSize, NSValue.valueOf(paperSize));
        return this;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public UIEdgeInsets getPaperMargin() {
        if (has(NSAttributedStringDocumentAttribute.PaperMargin)) {
            NSValue val = (NSValue) get(NSAttributedStringDocumentAttribute.PaperMargin);
            return val.edgeInsetsValue();
        }
        return null;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public NSAttributedStringDocumentAttributes setPaperMargin(UIEdgeInsets paperMargin) {
        set(NSAttributedStringDocumentAttribute.PaperMargin, NSValue.valueOf(paperMargin));
        return this;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public CGSize getViewSize() {
        if (has(NSAttributedStringDocumentAttribute.ViewSize)) {
            NSValue val = (NSValue) get(NSAttributedStringDocumentAttribute.ViewSize);
            return val.sizeValue();
        }
        return null;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public NSAttributedStringDocumentAttributes setViewSize(CGSize viewSize) {
        set(NSAttributedStringDocumentAttribute.ViewSize, NSValue.valueOf(viewSize));
        return this;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public double getViewZoom() {
        if (has(NSAttributedStringDocumentAttribute.ViewZoom)) {
            NSNumber val = (NSNumber) get(NSAttributedStringDocumentAttribute.ViewZoom);
            return val.doubleValue();
        }
        return 0;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public NSAttributedStringDocumentAttributes setViewZoom(double viewZoom) {
        set(NSAttributedStringDocumentAttribute.ViewZoom, NSNumber.valueOf(viewZoom));
        return this;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public boolean isReadOnly() {
        if (has(NSAttributedStringDocumentAttribute.ReadOnly)) {
            NSNumber val = (NSNumber) get(NSAttributedStringDocumentAttribute.ReadOnly);
            return val.booleanValue();
        }
        return false;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public NSAttributedStringDocumentAttributes setReadOnly(boolean readOnly) {
        set(NSAttributedStringDocumentAttribute.ReadOnly, NSNumber.valueOf(readOnly));
        return this;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public UIColor getBackgroundColor() {
        if (has(NSAttributedStringDocumentAttribute.BackgroundColor)) {
            UIColor val = (UIColor) get(NSAttributedStringDocumentAttribute.BackgroundColor);
            return val;
        }
        return null;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public NSAttributedStringDocumentAttributes setBackgroundColor(UIColor backgroundColor) {
        set(NSAttributedStringDocumentAttribute.BackgroundColor, backgroundColor);
        return this;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public double getHyphenationFactor() {
        if (has(NSAttributedStringDocumentAttribute.HyphenationFactor)) {
            NSNumber val = (NSNumber) get(NSAttributedStringDocumentAttribute.HyphenationFactor);
            return val.doubleValue();
        }
        return 0;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public NSAttributedStringDocumentAttributes setHyphenationFactor(double hyphenationFactor) {
        set(NSAttributedStringDocumentAttribute.HyphenationFactor, NSNumber.valueOf(hyphenationFactor));
        return this;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public double getDefaultTabInterval() {
        if (has(NSAttributedStringDocumentAttribute.DefaultTabInterval)) {
            NSNumber val = (NSNumber) get(NSAttributedStringDocumentAttribute.DefaultTabInterval);
            return val.doubleValue();
        }
        return 0;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public NSAttributedStringDocumentAttributes setDefaultTabInterval(double defaultTabInterval) {
        set(NSAttributedStringDocumentAttribute.DefaultTabInterval, NSNumber.valueOf(defaultTabInterval));
        return this;
    }
    /**/
    /**
     * @since Available in iOS 7.0 and later.
     */
    public NSDocumentViewMode getViewMode() {
        if (has(NSAttributedStringDocumentAttribute.ViewMode)) {
            NSNumber val = (NSNumber) get(NSAttributedStringDocumentAttribute.ViewMode);
            return NSDocumentViewMode.values()[val.intValue()];
        }
        return null;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public NSAttributedStringDocumentAttributes setViewMode(NSDocumentViewMode viewMode) {
        set(NSAttributedStringDocumentAttribute.ViewMode, NSNumber.valueOf(viewMode.ordinal()));
        return this;
    }
    
    @SuppressWarnings("unchecked")
    public List getTextLayoutSections() {
        List list = new ArrayList<>();
        if (has(NSAttributedStringDocumentAttribute.TextLayoutSections)) {
            NSArray> val = (NSArray>)get(NSAttributedStringDocumentAttribute.TextLayoutSections);
            for (NSDictionary e : val) {
                list.add(new NSTextLayoutSection(e));
            }
        }
        return list;
    }
    /**
     * @since Available in iOS 7.0 and later.
     */
    public NSAttributedStringDocumentAttributes setTextLayoutSections(List sections) {
        NSArray> list = new NSMutableArray<>();
        for (NSTextLayoutSection e : sections) {
            list.add(e.getDictionary());
        }
        set(NSAttributedStringDocumentAttribute.TextLayoutSections, list);
        return this;
    }
    
    /**/
    /**/
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy