Context Interfaces - kaisu1986/ATF GitHub Wiki

Table of Contents

This section describes each of ATF's context interfaces and their usage. Other sections discuss Context Classes and Context Related Classes.

Context Interface List

The following table lists the context interfaces and describes the kind of context where the interface can be used.

Context Interface Description, used where... Methods, Properties, Events Used in
IColoringContext Items can be colored. GetColor(), CanSetColor(), SetColor() CircuitEditingContext class
IEnumerableContext Context can provide an enumeration of all its items. Complements ISelectionContext. Items Numerous samples, including ATF Fsm Editor Sample, ATF Simple DOM Editor Sample, ATF Timeline Editor Sample
IHierarchicalInsertionContext Context can insert new objects (e.g., via drag and drop) under a specific parent object. Normally implemented along with IInstancingContext. CanInsert(), Insert() ATF Tree List Editor Sample to allow specific tree editors like ProjectLister to tell the context which node a user has dragged an object to. This context is used by ApplicationUtil's CanInsert() and Insert() methods and is preferred over IInstancingContext if both are implemented.
IHistoryContext Context has history, such as commands with history. It enables implementing "Undo"/"Redo" commands, tracking what has changed since the document was last saved. CanUndo(), CanRedo(), UndoDescription(), RedoDescription(), Undo(), Redo(). Dirty. Event DirtyChanged HistoryContext class
IInstancingContext Context can instance objects, which requires the ability to copy, insert, and delete items. Consider implementing IHierarchicalInsertionContext, too, if this context has data that is exposed to any kind of tree control, like ProjectLister. IInstancingContext should be used to create new instances, as in "Group"/"Ungroup" commands. In a WinForms application, the object type is probably System.Windows.Forms.IDataObject, and in a WPF application, this object can be a System.Windows.IDataObject. For more details, see Instancing In ATF. CanCopy(), Copy(), CanInsert(), Insert(), CanDelete(), Delete() Several samples, including ATF DOM Tree Editor Sample, ATF Fsm Editor Sample, ATF Simple DOM Editor Sample
ILabelEditingContext Context supports editing item labels. WPF only. CanEditLabel(), EditLabel(), GetLabel(), SetLabel(). Event BeginLabelEdit EditLabelCommand class
ILayeringContext Context with layering. Layering contexts control item visibility and provide a tree view of layers. Implements IVisibilityContext, ITreeView, and IItemView. SetActiveItem() LayerLister component
ILayoutContext Items can be positioned and resized. Contains methods for getting and setting item bounding rectangles, information on which parts of the bounds are meaningful, and which parts of bounds can be set. Has both WinForms and WPF versions, which have exactly the same methods and extension methods, with slightly different implementations. GetBounds(), CanSetBounds(), SetBounds() StandardLayoutCommands component. ATF Fsm Editor Sample, ATF State Chart Editor Sample
ILockingContext Items can be locked, so they can't be modified or deleted. Designed for locking individual objects within a document. IsLocked(), CanSetLocked(), SetLocked() StandardLockCommands. For locking documents, see ISourceControlContext and SourceControlCommands.
INamingContext Objects can be named. GetName(), CanSetName(), SetName() ATF DOM Tree Editor Sample, ATF Fsm Editor Sample, ATF State Chart Editor Sample, ATF Timeline Editor Sample
IObservableContext Context can provide update events for changes to its contents. Allow observers of list and tree data to track changes. If an application finds that the active context implements IObservableContext, it can implement an editable view that stays in sync with the data. If applications do not find IObservableContext, they can assume the view is read-only and still consume data. Events ItemInserted, ItemRemoved, ItemChanged, Reloaded Numerous samples, including ATF DOM Tree Editor Sample, ATF File Explorer Sample, ATF Simple DOM Editor Sample, ATF Simple DOM No XML Editor Sample
IPropertyEditingContext Properties can be edited by controls. Allow property editing controls, such as PropertyGrid or GridControl, to get properties and items with properties, enabling property editing controls to display objects and their properties. Items, PropertyDescriptors PropertyView class
IPrototypingContext Prototyping context, which can present a tree view of its contents and create IDataObjects from them. Implements ITreeView and IItemView. SetActiveItem(), GetInstances() PrototypeLister component. ATF Fsm Editor Sample, ATF State Chart Editor Sample
IQueryableContext Classes in which objects may be searched. Query() DomNodeQueryable class
IQueryableReplaceContext Classes in which containing objects may be replaced. Replace() DomNodeQueryable class
IQueryableResultContext Accessing the results of a query and being notified when those results change. Results. Event ResultsChanged DomNodeQueryable class
ISearchableContext Context provides search and replace capabilities through a client-defined UI. SearchUI, ReplaceUI, ResultsUI ATF Simple DOM Editor Sample
ISelectionContext Items can be selected. This interface distills what it means to have a selection in a context. It provides filtering, so you can get the last selected object of a certain type. It has an efficient method for determining if a selection contains an object. GetSelection<T>(), GetLastSelected<T>(), SelectionContains(). Selection, LastSelected, SelectionCount. Events SelectionChanging, SelectionChanged SelectionContext class. Several samples, including ATF File Explorer Sample, ATF Simple DOM Editor Sample, ATF Tree List Editor Sample
ISourceControlContext Source control context. Users of this interface can use the IResource to examine URIs and adapt the IResource to IDocument to track a document's dirty flag. Resources SourceControlCommands
ISubSelectionContext Context supports selection and can optionally specify a "sub-selection" context, i.e., the selection context of sub-elements, related to the selection in this context. This interface serves to abstractly allow consumers of selection contexts to hook into events from sub-selections. Implements ISelectionContext. SubSelectionContext ATF Simple DOM Editor Sample
ITemplatingContext Prototyping context, which can present a tree view of its contents and create IDataObjects from them. Implements ITreeView and IItemView. SetActiveItem(), GetInstances(), CanReference(), CreateReference() TemplatingContext class. TemplateLister component
ITransactionContext Data is changed in transactions, which can rolled back, simplifying editor design. Transactions can be cancelled any time before calling End(). Different modules can contribute to an operation without having to know about each other, and if an exception occurs in one module, the whole transaction can be rolled back. Begin(), Cancel(), End(). InTransaction TransactionContext class. Several samples, including ATF DOM Tree Editor Sample, ATF Fsm Editor Sample, ATF Timeline Editor Sample
IValidationContext Context provides events so listeners can perform validation. It's useful for marking when the user begins and ends logical commands. Validation events allow listeners to update themselves and check constraints more efficiently. Events Beginning, Cancelled, Ending, Ended ATF Tree List Editor Sample
IViewingContext Items can be viewed. Its methods check whether objects are or can be made visible, or are framed or can be framed in the current view. CanFrame(), Frame(), CanEnsureVisible(), EnsureVisible() StandardViewCommands component. Several samples, including ATF Fsm Editor Sample, ATF State Chart Editor Sample
IViewingContext Items can be viewed. WPF version, derived from Sce.Atf.Applications.IViewingContext Adaptable, ViewingAdapter, PickingAdapters, LayoutConstraints
IVisibilityContext Items can be shown and hidden. IsVisible(), CanSetVisible(), SetVisible() StandardShowCommands component

Topics in this section

⚠️ **GitHub.com Fallback** ⚠️