This page last changed on Jun 18, 2008 by sfentress.

All (or almost all) views for OTrunk components provide affordances to a learner or author which allow that user to change some attribute of that object. For example, the basic drawing tool view, OTDrawingToolView, allows a user to add graphables to the tool, such as lines and stamps. These changes will then be saved either in the learner database or in the OTrunk database, depending on which mode the author is in. If the changes were made in the OTrunk database (by using the system property, then the activity could be saved as a complete OTML file with the changes included.

However, most basic views of OTrunk components allow only a small set of attributes to be edited. For example, the default view of a Data Table, OTDataTableView, allows text to be entered into the table's cells, but does not allow the author to change the table's title, or the number of columns in the table. For this reason, authoring views of most OTrunk components have been created which allow an author to change attributes of a component that would normally be inaccessible to a student.

Authoring views are no different from other views except in the number of attributes they allow a user to directly edit. Thus, while the OTDataTableView only allows text to be entered into the table's cells, the OTDataTableEditView provides further UI affordances to allow changing the number of columns, adding titles to the columns, locking individual columns from being edited, and sharing the data from the table with other components.

Many authoring views also provide a preview of what the component will look like to a learner, frequently in a tabbed pane. This preview is generated by requesting the default view from the OTViewFactory and embedding that view within the authoring view. For this to work, the authoring view expects to be defined within the ViewBundle within a specific view mode, and for the learner view to be defined as the default view within that bundle. For more on view modes, see OTrunk View System and OTrunk View Modes.

View class naming conventions

Most default view classes in OTrunk use the naming convention "<OT component name>+View"; e.g. OTDrawingTool -> OTDrawingToolView, OTDataCollector -> OTDataCollectorView.

Views that represent variations on the default view provide the name of that variation between the component name and "View". For example, the version of the OTDrawingTool view which does not allow the student to draw is OTDrawingToolNonEditableView.

Authoring views thus generally add the word "Edit" to the view name, giving OTDataCollector -> OTDataCollectorEditView, OTDataTable -> OTDataTableEditView.

Creating new authoring views

Authoring views can be created exactly as regular views. The only difference is that the UI affordances will generally allow more access to the components attributes.

An authoring view can either be a subclass to the original default view, or it can be a new view entirely. If the authoring view is subclassed, then a preview of the view can be generated simply by calling the getComponent method of the parent view. If a separate class is created, then it will need to be able to embed the view inside itself to provide a preview.

To embed the preview inside itself, the authoring view should typically extend AbstractOTJComponentContainerView. This will provide access to methods which will make embedding the default view possible. The easiest way to get the component provided by the default view mode is to use

getChildComponent(otDraw, null, OTViewFactory.NO_VIEW_MODE, viewContext, jComponentViewContext)

This requires that the learner/preview view be defined as the default view in the ViewBundle. See OTrunk View Modes for more details.

More complex authoring

Some components are able to engage in complex interactions with other OTrunk components. For example, data may be shared between two graphs, or a component may need to know what other components exist in the activity. For these kinds of interactions the OTJComponentViewContext is very helpful as it can provide a list of all OTrunk components within the component's view context.

An example of using the OTJComponentViewContext to create a list of OTrunk components can be seen in the OTSnapshotButtonEditView.

Graphs, tables and other objects that use data may with the share their data between each other. For this, the OTJComponentViewContext may not be sufficient as the components may reside on different pages, in different contexts, and, further, the data cannot be named or annotated. For this reason, the OTSharingBundle and OTSharingManager were created. This is a simple way for a data-rich object to add itself or its datastore to a list during authoring. View can then request this list to find which components are sharing themselves, and can then use the data contained by those objects.

Examples of authoring views


Default view Authoring view


Default view Authoring view Advanced authoring view

See also

drawing-default.png (image/png)
graph-authoring-2.png (image/png)
graph-authoring.png (image/png)
graph-default.png (image/png)
drawing-authoring.png (image/png)
Document generated by Confluence on Jan 27, 2014 16:52