UniVista Programmer's Guide



Intent | Structure | Participants | Sample Code | Known Uses


The StudyEditor is the workspace for Study objects. This allows the creation and editing of Screen objects, which compose the Study. The UI editing area is done within the ScreenRenderer object, which is just a UI container (refer to the UI diagram below). Once a Study is complete, it is then saved to the backing store, in this case the database. All menu item calls are defined within this class.



Sample Code

To create a new menu item for the MenuBar or the PopupMenu, follow the following example.
// create the menu item
JMenuItem newItem = new JMenuItem("MenuName");
newItem.setToolTipText("A tip");

// add a listener defined somewhere else, or do it in-place
newItem.addActionListener(new SomeActionListener());
Most actions are supported through Callbacks (UniVista.support). An example of this is in saving a Study when a menu item was selected.
// lisetner for the save menu item
class SaveListener implements ActionListener {
public void actionPerformed(ActionEvent evt) {

// ask if changes are to be saved to the current study
private void askSaveStudyChanges(){
if(editedStudy!=null) {
(new SaveChangesDialog(new SaveStudyCallback(),
And the Callback defined in this case looks like this.
class SaveStudyCallback implements Callback {
public void entryPoint(Object obj) {
try {
if (actualStudy != null)
} catch (Exception e) {
//+++ insert error handling code here

Known Uses

The only instance of the StudyEditor that gets created is from the main menu. This means that the UniVistaMain (UniVista.gui) class is responsible for reacting to a user's command event.

Contact the UniVista Team | Main Page | Table of Contents