API 0.9.5
CPDocument Class Reference

#import <CPDocument.h>

Inheritance diagram for CPDocument:

List of all members.

Instance Methods

(void) - addViewController:forWindowController:
(void) - addWindowController:
(void) - alertDidEnd:returnCode:
(void) - canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:
(void) - close
(void) - connection:didFailWithError:
(void) - connection:didReceiveData:
(void) - connection:didReceiveResponse:
(void) - connectionDidFinishLoading:
(CPData- dataOfType:error:
(CPString- displayName
(CPString- fileType
(CPURL- fileURL
(CPWindowController- firstEligibleExistingWindowController
(BOOL) - hasUndoManager
(id) - init
(id) - initForURL:withContentsOfURL:ofType:delegate:didReadSelector:contextInfo:
(id) - initWithContentsOfURL:ofType:delegate:didReadSelector:contextInfo:
(id) - initWithType:error:
(BOOL) - isDocumentEdited
(void) - makeViewAndWindowControllers
(void) - makeWindowControllers
(void) - readFromData:ofType:error:
(void) - readFromURL:ofType:delegate:didReadSelector:contextInfo:
(void) - removeViewController:
(void) - removeWindowController:
(void) - saveDocument:
(void) - saveDocumentAs:
(void) - saveDocumentWithDelegate:didSaveSelector:contextInfo:
(void) - saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:
(void) - setFileType:
(void) - setFileURL:
(void) - setHasUndoManager:
(void) - setUndoManager:
(void) - shouldCloseWindowController:delegate:shouldCloseSelector:contextInfo:
(void) - showWindows
(CPUndoManager- undoManager
(void) - updateChangeCount:
(CPView- view
(CPString- viewCibName
(void) - viewControllerDidLoadCib:
(CPViewController- viewControllerForWindowController:
(CPArray- viewControllers
(void) - viewControllerWillLoadCib:
(CPString- windowCibName
(void) - windowControllerDidLoadCib:
(CPArray- windowControllers
(void) - windowControllerWillLoadCib:
(CPUndoManager- windowWillReturnUndoManager:

Detailed Description

CPDocument is used to represent a document/file in a Cappuccino application. In a document-based application, generally multiple documents are open simultaneously (multiple text documents, slide presentations, spreadsheets, etc.), and multiple CPDocuments should be used to represent this.

Definition at line 2 of file CPDocument.h.


Method Documentation

- (void) addViewController: (CPViewController aViewController
forWindowController: (CPWindowController aWindowController 

Definition at line 342 of file CPDocument.j.

- (void) addWindowController: (CPWindowController aWindowController

Add a controller to the document's list of controllers. This should be called after making a new window controller.

Parameters:
aWindowControllerthe controller to add

Definition at line 310 of file CPDocument.j.

- (void) alertDidEnd: (CPAlert alert
returnCode: (int)  returnCode 

Definition at line 896 of file CPDocument.j.

- (void) canCloseDocumentWithDelegate: (id)  aDelegate
shouldCloseSelector: (SEL)  aSelector
contextInfo: (Object)  context 

Definition at line 875 of file CPDocument.j.

- (void) close

Definition at line 852 of file CPDocument.j.

- (void) connection: (CPURLConnection aConnection
didFailWithError: (CPError)  anError 

Definition at line 584 of file CPDocument.j.

- (void) connection: (CPURLConnection aConnection
didReceiveData: (CPString aData 

Definition at line 557 of file CPDocument.j.

- (void) connection: (CPURLConnection aConnection
didReceiveResponse: (CPURLResponse aResponse 

Definition at line 501 of file CPDocument.j.

- (void) connectionDidFinishLoading: (CPURLConnection aConnection

Definition at line 612 of file CPDocument.j.

- (CPData) dataOfType: (CPString aType
error: ({CPError})  anError 

Returns the receiver's data in a specified type. The default implementation just throws an exception.

Parameters:
aTypethe format of the data
anErrornot used
Exceptions:
CPUnsupportedMethodExceptionif this method hasn't been overridden by the subclass
Returns:
the document data

Definition at line 207 of file CPDocument.j.

- (CPString) displayName

Returns the name of the document as displayed in the title bar.

Definition at line 374 of file CPDocument.j.

- (CPString) fileType

Returns the document's file type

Definition at line 659 of file CPDocument.j.

- (CPURL) fileURL

Returns the path to the document's file.

Definition at line 439 of file CPDocument.j.

- (CPWindowController) firstEligibleExistingWindowController

Definition at line 236 of file CPDocument.j.

- (BOOL) hasUndoManager

Returns YES if the document has a CPUndoManager.

Definition at line 669 of file CPDocument.j.

- (id) init

Initializes an empty document.

Returns:
the initialized document

Definition at line 114 of file CPDocument.j.

- (id) initForURL: (CPURL anAbsoluteURL
withContentsOfURL: (CPURL absoluteContentsURL
ofType: (CPString aType
delegate: (id)  aDelegate
didReadSelector: (SEL)  aDidReadSelector
contextInfo: (id)  aContextInfo 

Initializes the document from a URL.

Parameters:
anAbsoluteURLthe document location
absoluteContentsURLthe location of the document's contents
aTypethe type of the contents
aDelegatethis object will receive a callback after the document's contents are loaded
aDidReadSelectorthe message selector that will be sent to aDelegate
aContextInfopassed as the argument to the message sent to the aDelegate
Returns:
the initialized document

Definition at line 184 of file CPDocument.j.

- (id) initWithContentsOfURL: (CPURL anAbsoluteURL
ofType: (CPString aType
delegate: (id)  aDelegate
didReadSelector: (SEL)  aDidReadSelector
contextInfo: (id)  aContextInfo 

Initializes a document of a specific type located at a URL. Notifies the provided delegate after initialization.

Parameters:
anAbsoluteURLthe url of the document content
aTypethe type of document located at the URL
aDelegatethe delegate to notify
aDidReadSelectorthe selector used to notify the delegate
aContextInfocontext information passed to the delegate after initialization
Returns:
the initialized document

Definition at line 159 of file CPDocument.j.

- (id) initWithType: (CPString aType
error: ({CPError})  anError 

Initializes the document with a specific data type.

Parameters:
aTypethe type of document to initialize
anErrornot used
Returns:
the initialized document

Definition at line 138 of file CPDocument.j.

- (BOOL) isDocumentEdited

Returns YES if there are any unsaved changes.

Definition at line 622 of file CPDocument.j.

- (void) makeViewAndWindowControllers

Definition at line 250 of file CPDocument.j.

- (void) makeWindowControllers

Creates the window controller for this document.

Definition at line 245 of file CPDocument.j.

- (void) readFromData: (CPData aData
ofType: (CPString aType
error: (CPError)  anError 

Sets the content of the document by reading the provided data. The default implementation just throws an exception.

Parameters:
aDatathe document's data
aTypethe document type
anErrornot used
Exceptions:
CPUnsupportedMethodExceptionif this method hasn't been overridden by the subclass

Definition at line 222 of file CPDocument.j.

- (void) readFromURL: (CPURL anAbsoluteURL
ofType: (CPString aType
delegate: (id)  aDelegate
didReadSelector: (SEL)  aDidReadSelector
contextInfo: (id)  aContextInfo 

Set the document's data from a URL. Notifies the provided delegate afterwards.

Parameters:
anAbsoluteURLthe URL to the document's content
aTypethe document type
aDelegatedelegate to notify after reading the data
aDidReadSelectormessage that will be sent to the delegate
aContextInfocontext information that gets sent to the delegate

Definition at line 426 of file CPDocument.j.

- (void) removeViewController: (CPViewController aViewController

Definition at line 351 of file CPDocument.j.

- (void) removeWindowController: (CPWindowController aWindowController

Remove a controller to the document's list of controllers. This should be called after closing the controller's window.

Parameters:
aWindowControllerthe controller to remove

Definition at line 323 of file CPDocument.j.

- (void) saveDocument: (id)  aSender

Saves the document. If the document does not have a file path to save to (fileURL) then -saveDocumentAs: will be called.

Parameters:
aSenderthe object requesting the save

Definition at line 788 of file CPDocument.j.

- (void) saveDocumentAs: (id)  aSender

Saves the document to a user specified path.

Parameters:
aSenderthe object requesting the operation

Definition at line 811 of file CPDocument.j.

- (void) saveDocumentWithDelegate: (id)  delegate
didSaveSelector: (SEL)  didSaveSelector
contextInfo: (Object)  contextInfo 

Definition at line 793 of file CPDocument.j.

- (void) saveToURL: (CPURL anAbsoluteURL
ofType: (CPString aTypeName
forSaveOperation: (CPSaveOperationType)  aSaveOperation
delegate: (id)  aDelegate
didSaveSelector: (SEL)  aDidSaveSelector
contextInfo: (id)  aContextInfo 

Saves the document to the specified URL. Notifies the provided delegate with the provided selector and context info afterwards.

Parameters:
anAbsoluteURLthe url to write the document data to
aTypeNamethe document type
aSaveOperationthe type of save operation
aDelegatethe delegate to notify after saving
aDidSaveSelectorthe selector to send the delegate
aContextInfocontext info that gets passed to the delegate

Definition at line 468 of file CPDocument.j.

- (void) setFileType: (CPString aType

Sets the document's file type

Parameters:
aTypethe document's type

Definition at line 651 of file CPDocument.j.

- (void) setFileURL: (CPURL aFileURL

Sets the path to the document's file.

Parameters:
aFileURLthe path to the document's file

Definition at line 448 of file CPDocument.j.

- (void) setHasUndoManager: (BOOL)  aFlag

Sets whether the document should have a CPUndoManager.

Parameters:
aFlagYES makes the document have an undo manager

Definition at line 678 of file CPDocument.j.

- (void) setUndoManager: (CPUndoManager anUndoManager

Definition at line 717 of file CPDocument.j.

- (void) shouldCloseWindowController: (CPWindowController controller
delegate: (id)  delegate
shouldCloseSelector: (SEL)  selector
contextInfo: (Object)  info 

Definition at line 858 of file CPDocument.j.

- (void) showWindows

Shows all the document's windows.

Definition at line 365 of file CPDocument.j.

- (CPUndoManager) undoManager

Returns the document's undo manager. If the document should have one, but the manager is nil, it will be created and then returned.

Returns:
the document's undo manager

Reimplemented from CPResponder.

Definition at line 764 of file CPDocument.j.

- (void) updateChangeCount: (CPDocumentChangeType)  aChangeType

Updates the number of unsaved changes to the document.

Parameters:
aChangeTypea new document change to apply

Definition at line 631 of file CPDocument.j.

- (CPView) view

Definition at line 332 of file CPDocument.j.

- (CPString) viewCibName

Definition at line 388 of file CPDocument.j.

- (void) viewControllerDidLoadCib: (CPViewController aViewController

Definition at line 232 of file CPDocument.j.

- (CPViewController) viewControllerForWindowController: (CPWindowController aWindowController

Definition at line 356 of file CPDocument.j.

- (CPArray) viewControllers

Definition at line 337 of file CPDocument.j.

- (void) viewControllerWillLoadCib: (CPViewController aViewController

Definition at line 228 of file CPDocument.j.

- (CPString) windowCibName

Returns the document's Cib name

Definition at line 396 of file CPDocument.j.

- (void) windowControllerDidLoadCib: (CPWindowController aWindowController

Called after aWindowController loads the document's Nib file.

Parameters:
aWindowControllerthe controller that loaded the Nib file

Definition at line 405 of file CPDocument.j.

- (CPArray) windowControllers

Returns the document's window controllers

Definition at line 300 of file CPDocument.j.

- (void) windowControllerWillLoadCib: (CPWindowController aWindowController

Called before aWindowController will load the document's Nib file.

Parameters:
aWindowControllerthe controller that will load the Nib file

Definition at line 413 of file CPDocument.j.

- (CPUndoManager) windowWillReturnUndoManager: (CPWindow aWindow

Definition at line 776 of file CPDocument.j.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Defines