We've had an object called the OTModeSwitcher for some time, which
allowed you to wrap an object within a mode switcher, so that when
viewing the object in authoring mode you can get tabs at the top of the
window for switching between author and student modes. The
OTCurriculumUnit also implements this functionality when wrapping an
activity.
However, both of these required wrapping the component you want to
enable mode switching on with another OTObject. This is annoying if,
say, you want a specific object to be the root of an otml file, and also
requires changing the structure of (maybe many) otml files if you want
to add this ability later.
I've now added a simple view, OTObjectModeSwitcherView, which can be
used with any object. The result is the same as if it were wrapped in a
OTModeSwitcher, but does not require changing the structure of the ot
objects.
The viewConfig for this view takes a list of named modes, and allows the
user to switch between these modes. If we want to switch between
"authoring" and "student" modes, this view will therefore need to be in
a third mode, e.g. "switch," which is what you will run in when you want
to see the switcher.
An example if this can be found in er-view-bundle.otml. There already
existed "student" and "authoring" modes. I then added the following mode
and view entry:
<OTViewMode name="switch">
<map>
<entry key="${environment-holder-view}">
<OTObjectModeSwitcherViewConfig
objectClass="org.concord.otrunk.biologica.environment.OTEnvironmentHolder"
viewClass="org.concord.otrunk.ui.swing.OTObjectModeSwitcherView">
<modes>
<string>authoring</string>
<string>student</string>
</modes>
</OTObjectModeSwitcherViewConfig>
</entry>
</map>
</OTViewMode>
Now if I run any ER example in "switch" mode, I get the tabbed panel
which allows me to switch modes.
This may be a good addition to the raw otml editing in RITES. Since
models and other chunks of raw otml are unlikely to come pre-wrapped in
OTModeSwitchers or OTCurriculumUnits, this allows authoring with the
tabbed mode switching.
Sam