Skip to content

Context Classes

Gary edited this page Mar 10, 2015 · 2 revisions

Table of Contents

Several classes implement services for a context. Most, but not all, implement one or more of the context interfaces described in Context Interfaces. Another section discusses Context Related Classes, which use context interfaces in their operation.

Note that many of these classes are DOM adapters. The samples often define these adapters for their data model's types.

Because Sce.Atf.Dom.EditingContext is widely used in the samples, it merits special mention.

Context Classes

This table describes classes that provide services for a context.

Context Class Description DOM
Adapter?
Context Interfaces Implemented Used in
BitmapContext Rendering context for OpenGL® for creating bitmaps. No ThumbnailGenerator class
CircuitEditingContext Class that defines a circuit editing context. Each context represents a circuit, with a history, selection, and editing capabilities. There may be multiple contexts within a single circuit document, because each sub-circuit has its own editing context. The class has a default implementation of IInstancingContext if no other
IInstancingContext adapters are associated with the DomNode. Derives from EditingContext.
Yes IEnumerableContext, INamingContext, IInstancingContext, IObservableContext, IColoringContext CircuitControlRegistry, GroupingCommands components
EditingContext A general editing context, which is a history context with a selection, providing a basic, self-contained editing context. There may be multiple EditingContexts in a document. Derives from HistoryContext. Yes ISelectionContext Various samples, including ATF DOM Tree Editor Sample, ATF Simple DOM Editor Sample, ATF State Chart Editor Sample, ATF Timeline Editor Sample. For a further discussion, see General Purpose EditingContext Class.
GlobalHistoryContext Adapter that implements a single global history on a DOM tree containing multiple local HistoryContexts. The adapter tracks all other HistoryContexts in the subtree rooted at a DomNode and passes their transactions to the global HistoryContext, which must be on the same DomNode as this adapter. Yes EditingContext class
HistoryContext Adapter that adds history to a TransactionContext. If the adapter can adapt the DomNode to an ISelectionContext, the history includes selection changes. Derives from TransactionContext. Yes IHistoryContext EditingContext, GlobalHistoryContext classes
LayeringContext Context for LayerLister component (or other component implementing ILayeringContext). This context has its own independent selection, but uses the main context's HistoryContext for undo/redo operations. IInstancingContext and IHierarchicalInsertionContext implementations control drag/drop and copy/paste operations within the LayerLister (internal), pastes/drops to the LayerLister and drag/copies from the LayerLister (external). The IObservableContext implementation notifies the LayerLister's TreeControl when a change occurs that requires an update of one or more tree nodes. Derives from SelectionContext. For more information on instancing contexts, see IInstancingContext and IHierarchicalInsertionContext Interfaces. Yes ILayeringContext, IInstancingContext, IHierarchicalInsertionContext, IObservableContext, INamingContext LayeringCommands component. ATF Circuit Editor Sample
MultipleHistoryContext Adapter that observes a DomNode subtree and synchronizes multiple history contexts by setting the IHistoryContext.Dirty property to the same value for every context. The root DOM node must be adaptable to IDocument. Yes Used as a DOM adapter in several samples, including ATF Circuit Editor Sample, ATF Fsm Editor Sample, ATF State Chart Editor Sample
PropertyEditingContext Context in which properties can be edited, holding the selected items whose properties are to be edited. The context provides a way to get descriptors for properties being edited. The context performs property edits as logical commands for the undo/redo system. No IPropertyEditingContext EmbeddedCollectionEditor, GridControl, PropertyGrid classes
PropertyEditorControl-Context Context for embedded property editing controls, which provides a safe, convenient interface for getting and setting values without worrying about the intricacies of property descriptors and transaction contexts. Is only constructed by PropertyView. No ITypeDescriptorContext PropertyEditingControl class. Also used by numerous value editors, such as ArrayEditingControl, BoundedFloatEditor, UniformArrayEditor.
PrototypingContext Editing context for prototypes in the circuit document. This context is bound to the PrototypeLister component when a circuit document becomes the active context. This context implements instancing differently than the CircuitContext. It can insert modules and connections, converting them into prototypes. It can only copy and delete prototypes. Derives from SelectionContext. Yes IPrototypingContext, IInstancingContext, IObservableContext, INamingContext Used as DOM adapter in ATF Circuit Editor Sample, ATF Fsm Editor Sample, ATF State Chart Editor Sample
SelectionContext Adapts a DOM node to an ISelectionContext, using an AdaptableSelection object. Yes ISelectionContext LayeringContext, PrototypingContext, TemplatingContext classes
SelectionPropertyEditing-Context Class that supports property editing on any ISelectionContext. It implements IObservableContext by raising the Reloaded event when the selection changes. It only raises the Reloaded event (although it tries to do that efficiently using an IValidationContext interface) if the selection context can be converted to an IValidationContext interface. No IPropertyEditingContext, IObservableContext GridPropertyEditor, PropertyEditingCommands, PropertyEditor components. Numerous samples, such as ATF DOM Tree Editor Sample, ATF Fsm Editor Sample, ATF Timeline Editor Sample.
TemplatingContext Editing context for templates library. This context (or one implementing ITemplatingContext) is bound to the TemplateLister component when a circuit document becomes the active context. This context has its own independent selection. Derives from SelectionContext. Yes ITemplatingContext, IInstancingContext, IObservableContext, INamingContext TemplatingCommands component. ATF Circuit Editor Sample
TransactionContext Adapts a DOM node to an ITransactionContext. Yes ITransactionContext, IValidationContext HistoryContext class
TypeDescriptorContext Lightweight implementation of ITypeDescriptorContext for convenient interaction with the System.ComponentModel framework. No ITypeDescriptorContext PropertyEditingControl, PropertyGridView classes.
ViewingContext Provides viewing functions for a Circuit object. It holds a reference to the AdaptableControl for viewing the Circuit object. It updates the control's canvas bounds during validation. Derives from Validator. Yes IViewingContext, ILayoutContext CircuitControlRegistry, GroupingCommands components. ATF Circuit Editor Sample

General Purpose EditingContext Class

The Sce.Atf.Dom.EditingContext is a generic editing context for applications and is a history context with a selection, providing a basic self-contained editing context. There may be multiple EditingContexts in an application. As a result of its utility and generality, EditingContext is used in several samples.

EditingContext derives from HistoryContext, which derives from TransactionContext.

TransactionContext implements both ITransactionContext and IValidationContext. ITransactionContext brackets changes to data between Begin()/End() transaction calls, which allow transactions to be monitored and cancelled, if necessary. As a complement, IValidationContext provides Beginning, Cancelled, Ending, and Ended events to allow transactions to be validated. TransactionContext provides transactions that can be undone.

HistoryContext adds history to a TransactionContext, providing a history context for undo/redo operations. HistoryContext implements IHistoryContext, whose methods test if operations can be undone or redone, and also perform that operation. If the implementing class can adapt to an ISelectionContext, the history includes selection changes.

EditingContext also implements ISelectionContext that provides the events, properties, and methods to support selection of some kind of item in the context.

For more information on IHistoryContext, ITransactionContext, and ISelectionContext, see Context Interfaces.

Topics in this section

Clone this wiki locally