Skip to content

Editing and Selecting Data with Contexts

Gary edited this page Mar 10, 2015 · 2 revisions

Table of Contents

Contexts for Editing

A context is the environment in which something exists or occurs. A context can also be seen as a circumstance in an application. ATF has interfaces and classes to provide services for an application's data and operations in various contexts. The term context is often used to refer to an instance of a context interface or class. For general information on contexts, see ATF Contexts and particularly that section's topic What is a Context.

An editor can devise context classes that provide services for editors, and they do this primarily by implementing various ATF interfaces. Two of the services provided in these contexts are creating new instances of data objects and selecting items to be edited. Creating new instances is discussed in Creating Data Instances.

Context classes are very frequently DOM adapters, because the ability to adapt application data to a context's interfaces is very useful. For more details, see DOM Adapter Context Classes. For more information on using DOM adapters in an editor, see Role Playing with Adaptation.

EditingContext Class

The class Sce.Atf.Dom.EditingContext is a generic editing context for applications and derives from HistoryContext, which derives from TransactionContext. This allows editing to be done in a transaction, so changes can be rolled back. In addition, EditingContext has a Selection property which is implemented as an AdaptableSelection, a collection representing a selection. It's easy to implement selection handling with AdaptableSelection. Many of the ATF samples base their editing context classes on EditingContext. For more information about this useful class, see General Purpose EditingContext Class. Note that EditingContext is a DOM adapter.

SimpleDOMEditor EventContext Class

The ATF Simple DOM Editor Sample's EventContext class derives from EditingContext and is used for editing an event in a sequence. In this editor, it means editing the resources associated with an event, which are displayed in a ListView control. EventContext implements several interfaces to enable this editing. For example, IListView provides an enumeration of objects that can be used as tags, one per row, in a list control, so it's ready made for a ListView. For more information on this and other interfaces used by EventContext, see IListView and IItemView Interfaces. For a discussion of what EventContext does, see EventContext Class.

Topics in this section

Clone this wiki locally