Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.bugvm.apple.uikit.UIDocument 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.*;
/* */
/**/
/**
* @since Available in iOS 5.0 and later.
*/
/* */
/**/@Library("UIKit") @NativeClass/* */
/**/public/* */ class /**/UIDocument/* */
extends /**/NSObject/* */
/**/implements NSFilePresenter, NSProgressReporting/* */ {
public static class Notifications {
/**
* @since Available in iOS 5.0 and later.
*/
public static NSObject observeStateChanged(UIDocument object, final VoidBlock1 block) {
return NSNotificationCenter.getDefaultCenter().addObserver(StateChangedNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1() {
@Override
public void invoke(NSNotification a) {
block.invoke((UIDocument) a.getObject());
}
});
}
}
/**/public static class UIDocumentPtr extends Ptr {}/* */
/**/static { ObjCRuntime.bind(UIDocument.class); }/* */
/**//* */
/**/
public UIDocument() {}
protected UIDocument(SkipInit skipInit) { super(skipInit); }
public UIDocument(NSURL url) { super((SkipInit) null); initObject(init(url)); }
/* */
/**/
@Property(selector = "fileURL")
public native NSURL getFileURL();
@Property(selector = "localizedName")
public native String getLocalizedName();
@Property(selector = "fileType")
public native String getFileType();
@Property(selector = "fileModificationDate")
public native NSDate getFileModificationDate();
@Property(selector = "setFileModificationDate:")
public native void setFileModificationDate(NSDate v);
@Property(selector = "documentState")
public native UIDocumentState getDocumentState();
@Property(selector = "undoManager")
public native NSUndoManager getUndoManager();
@Property(selector = "setUndoManager:")
public native void setUndoManager(NSUndoManager v);
/**
* @since Available in iOS 8.0 and later.
*/
@Property(selector = "userActivity")
public native NSUserActivity getUserActivity();
/**
* @since Available in iOS 8.0 and later.
*/
@Property(selector = "setUserActivity:")
public native void setUserActivity(NSUserActivity v);
@Property(selector = "presentedItemURL")
public native NSURL getPresentedItemURL();
@Property(selector = "presentedItemOperationQueue")
public native NSOperationQueue getPresentedItemOperationQueue();
@Property(selector = "progress")
public native NSProgress getProgress();
/* */
/**//* */
/**/
/**
* @since Available in iOS 5.0 and later.
*/
@GlobalValue(symbol="UIDocumentStateChangedNotification", optional=true)
public static native NSString StateChangedNotification();
/**
* @since Available in iOS 8.0 and later.
*/
@GlobalValue(symbol="NSUserActivityDocumentURLKey", optional=true)
public static native String UserActivityDocumentURLKey();
@Method(selector = "initWithFileURL:")
protected native @Pointer long init(NSURL url);
@Method(selector = "openWithCompletionHandler:")
public native void open(@Block VoidBooleanBlock completionHandler);
@Method(selector = "closeWithCompletionHandler:")
public native void close(@Block VoidBooleanBlock completionHandler);
public boolean loadFromContents(NSObject contents, String typeName) throws NSErrorException {
NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
boolean result = loadFromContents(contents, typeName, ptr);
if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
return result;
}
@Method(selector = "loadFromContents:ofType:error:")
private native boolean loadFromContents(NSObject contents, String typeName, NSError.NSErrorPtr outError);
public NSObject getContentsForType(String typeName) throws NSErrorException {
NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
NSObject result = getContentsForType(typeName, ptr);
if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
return result;
}
@Method(selector = "contentsForType:error:")
private native NSObject getContentsForType(String typeName, NSError.NSErrorPtr outError);
@Method(selector = "disableEditing")
public native void disableEditing();
@Method(selector = "enableEditing")
public native void enableEditing();
@Method(selector = "hasUnsavedChanges")
public native boolean hasUnsavedChanges();
@Method(selector = "updateChangeCount:")
public native void updateChangeCount(UIDocumentChangeKind change);
@Method(selector = "changeCountTokenForSaveOperation:")
public native NSObject getChangeCountToken(UIDocumentSaveOperation saveOperation);
@Method(selector = "updateChangeCountWithToken:forSaveOperation:")
public native void updateChangeCount(NSObject changeCountToken, UIDocumentSaveOperation saveOperation);
@Method(selector = "saveToURL:forSaveOperation:completionHandler:")
public native void save(NSURL url, UIDocumentSaveOperation saveOperation, @Block VoidBooleanBlock completionHandler);
@Method(selector = "autosaveWithCompletionHandler:")
public native void autoSave(@Block VoidBooleanBlock completionHandler);
@Method(selector = "savingFileType")
public native String getSavingFileType();
@Method(selector = "fileNameExtensionForType:saveOperation:")
public native String getFileNameExtension(String typeName, UIDocumentSaveOperation saveOperation);
public boolean writeContents(NSObject contents, NSFileAttributes additionalFileAttributes, NSURL url, UIDocumentSaveOperation saveOperation) throws NSErrorException {
NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
boolean result = writeContents(contents, additionalFileAttributes, url, saveOperation, ptr);
if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
return result;
}
@Method(selector = "writeContents:andAttributes:safelyToURL:forSaveOperation:error:")
private native boolean writeContents(NSObject contents, NSFileAttributes additionalFileAttributes, NSURL url, UIDocumentSaveOperation saveOperation, NSError.NSErrorPtr outError);
public boolean writeContents(NSObject contents, NSURL url, UIDocumentSaveOperation saveOperation, NSURL originalContentsURL) throws NSErrorException {
NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
boolean result = writeContents(contents, url, saveOperation, originalContentsURL, ptr);
if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
return result;
}
@Method(selector = "writeContents:toURL:forSaveOperation:originalContentsURL:error:")
private native boolean writeContents(NSObject contents, NSURL url, UIDocumentSaveOperation saveOperation, NSURL originalContentsURL, NSError.NSErrorPtr outError);
public NSFileAttributes getFileAttributesToWrite(NSURL url, UIDocumentSaveOperation saveOperation) throws NSErrorException {
NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
NSFileAttributes result = getFileAttributesToWrite(url, saveOperation, ptr);
if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
return result;
}
@Method(selector = "fileAttributesToWriteToURL:forSaveOperation:error:")
private native NSFileAttributes getFileAttributesToWrite(NSURL url, UIDocumentSaveOperation saveOperation, NSError.NSErrorPtr outError);
public boolean read(NSURL url) throws NSErrorException {
NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
boolean result = read(url, ptr);
if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
return result;
}
@Method(selector = "readFromURL:error:")
private native boolean read(NSURL url, NSError.NSErrorPtr outError);
@Method(selector = "performAsynchronousFileAccessUsingBlock:")
public native void performAsynchronousFileAccess(@Block Runnable block);
@Method(selector = "handleError:userInteractionPermitted:")
public native void handleError(NSError error, boolean userInteractionPermitted);
@Method(selector = "finishedHandlingError:recovered:")
public native void finishedHandlingError(NSError error, boolean recovered);
@Method(selector = "userInteractionNoLongerPermittedForError:")
public native void userInteractionNoLongerPermitted(NSError error);
@Method(selector = "revertToContentsOfURL:completionHandler:")
public native void revert(NSURL url, @Block VoidBooleanBlock completionHandler);
/**
* @since Available in iOS 8.0 and later.
*/
@Method(selector = "updateUserActivityState:")
public native void updateUserActivityState(NSUserActivity userActivity);
/**
* @since Available in iOS 8.0 and later.
*/
@Method(selector = "restoreUserActivityState:")
public native void restoreUserActivityState(NSUserActivity userActivity);
@Method(selector = "relinquishPresentedItemToReader:")
public native void relinquishPresentedItemToReader(@Block("(@Block)") VoidBlock1 reader);
@Method(selector = "relinquishPresentedItemToWriter:")
public native void relinquishPresentedItemToWriter(@Block("(@Block)") VoidBlock1 writer);
@Method(selector = "savePresentedItemChangesWithCompletionHandler:")
public native void savePresentedItemChanges(@Block VoidBlock1 completionHandler);
@Method(selector = "accommodatePresentedItemDeletionWithCompletionHandler:")
public native void accommodatePresentedItemDeletion(@Block VoidBlock1 completionHandler);
@Method(selector = "presentedItemDidMoveToURL:")
public native void presentedItemDidMoveToURL(NSURL newURL);
@Method(selector = "presentedItemDidChange")
public native void presentedItemDidChange();
@Method(selector = "presentedItemDidGainVersion:")
public native void presentedItemDidGainVersion(NSFileVersion version);
@Method(selector = "presentedItemDidLoseVersion:")
public native void presentedItemDidLoseVersion(NSFileVersion version);
@Method(selector = "presentedItemDidResolveConflictVersion:")
public native void presentedItemDidResolveConflictVersion(NSFileVersion version);
@Method(selector = "accommodatePresentedSubitemDeletionAtURL:completionHandler:")
public native void accommodatePresentedSubitemDeletionAtURL(NSURL url, @Block VoidBlock1 completionHandler);
@Method(selector = "presentedSubitemDidAppearAtURL:")
public native void presentedSubitemDidAppearAtURL(NSURL url);
@Method(selector = "presentedSubitemAtURL:didMoveToURL:")
public native void presentedSubitemAtURLDidMoveToURL(NSURL oldURL, NSURL newURL);
@Method(selector = "presentedSubitemDidChangeAtURL:")
public native void presentedSubitemDidChangeAtURL(NSURL url);
@Method(selector = "presentedSubitemAtURL:didGainVersion:")
public native void presentedSubitemAtURLDidGainVersion(NSURL url, NSFileVersion version);
@Method(selector = "presentedSubitemAtURL:didLoseVersion:")
public native void presentedSubitemAtURLDidLoseVersion(NSURL url, NSFileVersion version);
@Method(selector = "presentedSubitemAtURL:didResolveConflictVersion:")
public native void presentedSubitemAtURLDidResolveConflictVersion(NSURL url, NSFileVersion version);
/* */
}