-
Notifications
You must be signed in to change notification settings - Fork 263
What is a Document in ATF
A document is a file containing application data. Nearly all applications process data, so most have documents that can be saved and opened for later modification.
In ATF, a document object implements the IDocument
interface. IDocument
derives from IResource
, an interface for resources that have a type and unique resource identifier (URI).
IDocument
is very simple, consisting of:
-
IsReadOnly
property: indicate whether the document is read-only. -
Dirty
property: is the version of the document in memory different than the version in its file? -
DirtyChanged
event:Dirty
changed. -
Type
property (IResource
): get the text string that identifies this document type to the end-user. -
Uri
property (IResource
): get or set the document's URI as an absolute path. -
UriChanged
event (IResource
):Uri
changed.
DomDocument
class provides an implementation of IDocument
you can use in your application. DomDocument
is also a DOM adapter. Several ATF samples use DomDocument
, such as ATF Simple DOM Editor Sample.
Each type of document has one or more IDocumentClient
interfaces associated with it. A document client does the work of handling a document and implements IDocumentClient
for operations on the document, mainly file-related:
-
Info
property: getDocumentClientInfo
with information about the document client, such as file type and its file extensions, and so on. For details, see DocumentClientInfo Class below. -
CanOpen()
: can the document be opened? -
Open()
: open the document from a file. -
Show()
: display the document. -
Save()
: save the document to a file. -
Close()
: close the file.
IDocumentClient
interface for each type of document it handles. Different applications can handle the same document in different ways, so they could have different IDocumentClient
implementations for the same document. Applications processing text files may do so in very different ways, for instance. In addition, a single application could provide different views of application data and have several implementations of IDocumentClient
for the same document type. For example, an application could open an XML file containing a Schema as plain text or as a tree of nodes, as Visual Studio does.
DocumentClientInfo
holds information about a document for a particular document client. This information can be used to determine if a file can be opened, for example.
DocumentClientInfo
has a set of constructors, who between them, provide the following information:
- Name describing the type of document, unique for each document type in the application.
- File extensions (without the initial '.').
- Name of a "New document" icon used in the UI, such as on a menu item or button.
- Name of an "Open document" icon used in the UI, such as on a menu item or button.
- Whether the client can open multiple documents simultaneously.
-
What is a Document in ATF: Introduces the
IDocument
andIDocumentClient
interfaces that an individual document uses. -
Document Registry and Services: Discusses the
DocumentRegistry
to track documents and other document services offered inIDocumentService
. - Document Handling Components: Details the MEF components providing services document handlers need.
-
Implementing a Document and Its Client: Shows how to implement both
IDocument
andIDocumentClient
interfaces for a document type.
- Home
- Getting Started
- Features & Benefits
- Requirements & Dependencies
- Gallery
- Technology & Samples
- Adoption
- News
- Release Notes
- ATF Community
- Searching Documentation
- Using Documentation
- Videos
- Tutorials
- How To
- Programmer's Guide
- Reference
- Code Samples
- Documentation Files
© 2014-2015, Sony Computer Entertainment America LLC