Skip to content

ATF Simple DOM Editor Sample

Gary edited this page Mar 17, 2015 · 2 revisions

Table of Contents

Description

SimpleDomEditor is a sample editor that demonstrates the use of the DOM (Document Object Model). SimpleDomEditor operates on Event sequence files, *.xml or *.esq files, that contain a sequence of Events. The Events can contain Resources: animations or geometries. Each Event sequence file displays in a ListView control, which shows all Events and Resources that can be selected and edited, as well as the properties on the selected items to be edited. The editor can load multiple Event sequence files. The Resources editor tracks the last selected Event and displays its Resources in another ListView control.

For information about programming in this sample, see Simple DOM Editor Programming Discussion.

ATF Features Demonstrated by SimpleDomEditor

  • Define a data model using an EventSequence.xsd XML schema. XML is also used for application data.
  • Use of DomGen to autogenerate DOM metadata for use by adapters.
  • Use of adapters to decorate the DOM to create Event sequence data models.
  • Use of IDocumentClient and the document framework to manage multiple documents.
  • Show implementing IPaletteClient to create a UI parts palette.
  • Using ListView and ListViewAdapter to display editable lists of Events and Resources.
  • Use of IListView, IItemView, and IObservableContext interfaces to adapt data to a list.
  • Use of ContextRegistry to track the active editing context, so application components always apply where the user is editing.
  • Use of the interfaces IInstancingContext, ISelectionContext, and IHistoryContext to adapt data for editing commands.
  • Use of ATF PropertyEditor and GridPropertyEditor components to allow property editing on selected UI elements.

Run SimpleDomEditor

  1. Double-click the SimpleDomEditor.exe in \bin\wws_atf\Release.
  2. If the Event sequence file window that shows the edited file was closed without opening another file when SimpleDomEditor ran the last time, a Save As window appears. In this case, choose the location and new file name for your Event sequence file, then click Save. You can also create or open a file using toolbar buttons or the File menu item.
  3. The SimpleDomEditor window appears.

SimpleDomEditor has the following windows:

  • Palette (Events and Resources): choose Event, Animation, or Geometry.
  • Event sequence file: the current Event sequence file being edited.
  • Property Editor: edit a selected Event or Resource property in a list control.
  • Grid Property Editor: edit a selected Event or Resource property in a grid control.
  • Resources: list the Resources for the active Event sequence file.
  • Search and Replace: two panes to search and replace or search using a regular expression for DomNodes.
The toolbar and menu bar contain standard buttons for file management: save, create new, open existing, and so on, and editing: cut, copy, paste, delete, undo/redo, lock/unlock. The Edit menu also provides the standard editing functions as well as keyboard shortcuts, load or save settings, and preferences. Use the Window menu item to hide and show windows. Help provides information about SimpleDomEditor.

How to Use SimpleDomEditor

To start:

  1. Create an Event sequence file. Use the initial "Untitled.xml", or choose File > New Event Sequence in the SimpleDomEditor menu. A Save As window appears. Choose location and new file name for your Event sequence file, then click OK. An empty sequence file opens in the editing canvas.
  2. From the Palette, drag and drop an Event onto the Event sequence file window.
  3. Select an Event to view and edit Event properties.
To add Resources:
  1. Select an Event.
  2. Drag and drop Resources (Animation or Geometry) onto the Resource pane.
  3. Select a Resource to view and edit Resource properties.

SimpleDomEditor Modules

Modules perform these functions:

  • Program.cs: Contains the Main program. It creates a TypeCatalog listing the ATF and internal MEF components used.
  • Editor.cs: Implements IDocumentClient and uses the document framework to manage multiple documents, implement File menu commands, auto-new and open documents on startup.
  • PaletteClient.cs: Implements IPaletteClient and uses IPaletteService to create a UI parts palette.
  • EventListEditor.cs: Uses ListView and ListViewAdapter to display editable lists of Events and Resources.
  • ResourceListEditor.cs: Display and edit the Resources that belong to the most recently selected Event. It handles drag and drop, and right-click context menus for Events and Resources.
  • EventSequenceContext.cs, EventContext.cs: Use IListView, IItemView, and IObservableContext interfaces to adapt data to a list.
  • EventSequenceContext.cs, EventContext.cs: Implement the ATF interfaces IInstancingContext, ISelectionContext, and IHistoryContext to adapt data so that ATF command components can be used to get undo/redo, cut/paste, and selection commands.
  • DomNodeNameSearchControl.cs: Defines a simple GUI for searching and replacement of DomNode names on the currently active document.
  • HelpAboutCommand.cs: Implements a standard Help/About dialog.

Topics in this section

Clone this wiki locally