CPDocument is used to represent a document/file in a Cappuccino application. In a document-based application, generally multiple documents are open simutaneously (multiple text documents, slide presentations, spreadsheets, etc.), and multiple CPDocuments should be used to represent this.
Definition at line 94 of file CPDocument.j.
- (void) addViewController: | (CPViewController) | aViewController | ||
forWindowController: | (CPWindowController) | aWindowController | ||
[implementation] |
Definition at line 348 of file CPDocument.j.
- (void) addWindowController: | (CPWindowController) | aWindowController | [implementation] |
Add a controller to the document's list of controllers. This should be called after making a new window controller.
aWindowController | the controller to add |
Definition at line 316 of file CPDocument.j.
- (void) alertDidEnd: | (CPAlert) | alert | ||
returnCode: | (int) | returnCode | ||
[implementation] |
Definition at line 902 of file CPDocument.j.
- (void) canCloseDocumentWithDelegate: | (id) | aDelegate | ||
shouldCloseSelector: | (SEL) | aSelector | ||
contextInfo: | (Object) | context | ||
[implementation] |
Definition at line 881 of file CPDocument.j.
- (void) close | [implementation] |
Definition at line 858 of file CPDocument.j.
- (void) connection: | (CPURLConnection) | aConnection | ||
didFailWithError: | (CPError) | anError | ||
[implementation] |
Definition at line 590 of file CPDocument.j.
- (void) connection: | (CPURLConnection) | aConnection | ||
didReceiveData: | (CPString) | aData | ||
[implementation] |
Definition at line 563 of file CPDocument.j.
- (void) connection: | (CPURLConnection) | aConnection | ||
didReceiveResponse: | (CPURLResponse) | aResponse | ||
[implementation] |
Definition at line 507 of file CPDocument.j.
- (void) connectionDidFinishLoading: | (CPURLConnection) | aConnection | [implementation] |
Definition at line 618 of file CPDocument.j.
Returns the receiver's data in a specified type. The default implementation just throws an exception.
aType | the format of the data | |
anError | not used |
CPUnsupportedMethodException | if this method hasn't been overriden by the subclass |
Definition at line 213 of file CPDocument.j.
- (CPString) displayName | [implementation] |
Returns the name of the document as displayed in the title bar.
Definition at line 380 of file CPDocument.j.
- (CPString) fileType | [implementation] |
Returns the document's file type
Definition at line 665 of file CPDocument.j.
- (CPURL) fileURL | [implementation] |
Returns the path to the document's file.
Definition at line 445 of file CPDocument.j.
- (CPWindowController) firstEligibleExistingWindowController | [implementation] |
Definition at line 242 of file CPDocument.j.
- (BOOL) hasUndoManager | [implementation] |
Returns YES
if the document has a CPUndoManager.
Definition at line 675 of file CPDocument.j.
- (id) init | [implementation] |
Initializes an empty document.
Definition at line 120 of file CPDocument.j.
- (id) initForURL: | (CPURL) | anAbsoluteURL | ||
withContentsOfURL: | (CPURL) | absoluteContentsURL | ||
ofType: | (CPString) | aType | ||
delegate: | (id) | aDelegate | ||
didReadSelector: | (SEL) | aDidReadSelector | ||
contextInfo: | (id) | aContextInfo | ||
[implementation] |
Initializes the document from a URL.
anAbsoluteURL | the document location | |
absoluteContentsURL | the location of the document's contents | |
aType | the type of the contents | |
aDelegate | this object will receive a callback after the document's contents are loaded | |
aDidReadSelector | the message selector that will be sent to aDelegate | |
aContextInfo | passed as the argument to the message sent to the aDelegate |
Definition at line 190 of file CPDocument.j.
- (id) initWithContentsOfURL: | (CPURL) | anAbsoluteURL | ||
ofType: | (CPString) | aType | ||
delegate: | (id) | aDelegate | ||
didReadSelector: | (SEL) | aDidReadSelector | ||
contextInfo: | (id) | aContextInfo | ||
[implementation] |
Initializes a document of a specific type located at a URL. Notifies the provided delegate after initialization.
anAbsoluteURL | the url of the document content | |
aType | the type of document located at the URL | |
aDelegate | the delegate to notify | |
aDidReadSelector | the selector used to notify the delegate | |
aContextInfo | context information passed to the delegate after initialization |
Definition at line 165 of file CPDocument.j.
- (id) initWithType: | (CPString) | aType | ||
error: | ({CPError}) | anError | ||
[implementation] |
Initializes the document with a specific data type.
aType | the type of document to initialize | |
anError | not used |
Definition at line 144 of file CPDocument.j.
- (BOOL) isDocumentEdited | [implementation] |
Returns YES
if there are any unsaved changes.
Definition at line 628 of file CPDocument.j.
- (void) makeViewAndWindowControllers | [implementation] |
Definition at line 256 of file CPDocument.j.
- (void) makeWindowControllers | [implementation] |
Creates the window controller for this document.
Definition at line 251 of file CPDocument.j.
- (void) readFromData: | (CPData) | aData | ||
ofType: | (CPString) | aType | ||
error: | (CPError) | anError | ||
[implementation] |
Sets the content of the document by reading the provided data. The default implementation just throws an exception.
aData | the document's data | |
aType | the document type | |
anError | not used |
CPUnsupportedMethodException | if this method hasn't been overridden by the subclass |
Definition at line 228 of file CPDocument.j.
- (void) readFromURL: | (CPURL) | anAbsoluteURL | ||
ofType: | (CPString) | aType | ||
delegate: | (id) | aDelegate | ||
didReadSelector: | (SEL) | aDidReadSelector | ||
contextInfo: | (id) | aContextInfo | ||
[implementation] |
Set the document's data from a URL. Notifies the provided delegate afterwards.
anAbsoluteURL | the URL to the document's content | |
aType | the document type | |
aDelegate | delegate to notify after reading the data | |
aDidReadSelector | message that will be sent to the delegate | |
aContextInfo | context information that gets sent to the delegate |
Definition at line 432 of file CPDocument.j.
- (void) removeViewController: | (CPViewController) | aViewController | [implementation] |
Definition at line 357 of file CPDocument.j.
- (void) removeWindowController: | (CPWindowController) | aWindowController | [implementation] |
Remove a controller to the document's list of controllers. This should be called after closing the controller's window.
aWindowController | the controller to remove |
Definition at line 329 of file CPDocument.j.
- (void) saveDocument: | (id) | aSender | [implementation] |
Saves the document. If the document does not have a file path to save to (fileURL
) then -saveDocumentAs
: will be called.
aSender | the object requesting the save |
Definition at line 794 of file CPDocument.j.
- (void) saveDocumentAs: | (id) | aSender | [implementation] |
Saves the document to a user specified path.
aSender | the object requesting the operation |
Definition at line 817 of file CPDocument.j.
- (void) saveDocumentWithDelegate: | (id) | delegate | ||
didSaveSelector: | (SEL) | didSaveSelector | ||
contextInfo: | (Object) | contextInfo | ||
[implementation] |
Definition at line 799 of file CPDocument.j.
- (void) saveToURL: | (CPURL) | anAbsoluteURL | ||
ofType: | (CPString) | aTypeName | ||
forSaveOperation: | (CPSaveOperationType) | aSaveOperation | ||
delegate: | (id) | aDelegate | ||
didSaveSelector: | (SEL) | aDidSaveSelector | ||
contextInfo: | (id) | aContextInfo | ||
[implementation] |
Saves the document to the specified URL. Notifies the provided delegate with the provided selector and context info afterwards.
anAbsoluteURL | the url to write the document data to | |
aTypeName | the document type | |
aSaveOperation | the type of save operation | |
aDelegate | the delegate to notify after saving | |
aDidSaveSelector | the selector to send the delegate | |
aContextInfo | context info that gets passed to the delegate |
Definition at line 474 of file CPDocument.j.
- (void) setFileType: | (CPString) | aType | [implementation] |
Sets the document's file type
aType | the document's type |
Definition at line 657 of file CPDocument.j.
- (void) setFileURL: | (CPURL) | aFileURL | [implementation] |
Sets the path to the document's file.
aFileURL | the path to the document's file |
Definition at line 454 of file CPDocument.j.
- (void) setHasUndoManager: | (BOOL) | aFlag | [implementation] |
Sets whether the document should have a CPUndoManager.
aFlag | YES makes the document have an undo manager |
Definition at line 684 of file CPDocument.j.
- (void) setUndoManager: | (CPUndoManager) | anUndoManager | [implementation] |
Definition at line 723 of file CPDocument.j.
- (void) shouldCloseWindowController: | (CPWindowController) | controller | ||
delegate: | (id) | delegate | ||
shouldCloseSelector: | (SEL) | selector | ||
contextInfo: | (Object) | info | ||
[implementation] |
Definition at line 864 of file CPDocument.j.
- (void) showWindows | [implementation] |
Shows all the document's windows.
Definition at line 371 of file CPDocument.j.
- (CPUndoManager) undoManager | [implementation] |
Returns the document's undo manager. If the document should have one, but the manager is nil
, it will be created and then returned.
Definition at line 770 of file CPDocument.j.
- (void) updateChangeCount: | (CPDocumentChangeType) | aChangeType | [implementation] |
Updates the number of unsaved changes to the document.
aChangeType | a new document change to apply |
Definition at line 637 of file CPDocument.j.
- (CPView) view | [implementation] |
Definition at line 338 of file CPDocument.j.
- (CPString) viewCibName | [implementation] |
Definition at line 394 of file CPDocument.j.
- (void) viewControllerDidLoadCib: | (CPViewController) | aViewController | [implementation] |
Definition at line 238 of file CPDocument.j.
- (CPViewController) viewControllerForWindowController: | (CPWindowController) | aWindowController | [implementation] |
Definition at line 362 of file CPDocument.j.
- (CPArray) viewControllers | [implementation] |
Definition at line 343 of file CPDocument.j.
- (void) viewControllerWillLoadCib: | (CPViewController) | aViewController | [implementation] |
Definition at line 234 of file CPDocument.j.
- (CPString) windowCibName | [implementation] |
Returns the document's Cib name
Definition at line 402 of file CPDocument.j.
- (void) windowControllerDidLoadCib: | (CPWindowController) | aWindowController | [implementation] |
Called after aWindowController
loads the document's Nib file.
aWindowController | the controller that loaded the Nib file |
Definition at line 411 of file CPDocument.j.
- (CPArray) windowControllers | [implementation] |
Returns the document's window controllers
Definition at line 306 of file CPDocument.j.
- (void) windowControllerWillLoadCib: | (CPWindowController) | aWindowController | [implementation] |
Called before aWindowController
will load the document's Nib file.
aWindowController | the controller that will load the Nib file |
Definition at line 419 of file CPDocument.j.
- (CPUndoManager) windowWillReturnUndoManager: | (CPWindow) | aWindow | [implementation] |
Definition at line 782 of file CPDocument.j.