DTU 
 

 

02265: Advanced Topics in Software Engineering (f15)

Assignment 3 (due wk 9)
 
 

In this assignment, you will become accquainted with implementing a GUI for an ECNO application.

 

The assignment is to extend the GUI of an existing ECNO application (the "Workers" example, dk.dtu.imm.se.ecno.example.workers.worklistgui) with GUI elements for cancelling jobs. The GUI should be equipped with an additional panel that contains a combo box for selecting among all jobs, which are registered with the engine, and a button to cancel the selected job — if this is task is still active. To this end, the mechansisms to programmatically compute and execute possible interactions should be used.

 

The example GUI for the Workers example and the mechanisms for programming controllers and GUIs for an ECNO application are documented in Section 5.5 of the ECNO documentation; the ECNO models for the Workers example are discussed in Section 1.1.

 

Below, the major steps for these extensions are outlined.

 

  1. If you did not yet install the ECNO Tool and the examples yet, install them as described for tutorial 1: http://www2.compute.dtu.dk/courses/02265/f15/project/eclipse-installation.shtml.

     

    Import the plug-in project dk.dtu.imm.se.ecno.example.workers.worklistgui, which comes as part of the ECNO installation, to your workspace ("Import As -> Source Project" in the Plug-ins view).

     

  2. Make yourself comfortable with the classes WorkersGUI and WorklistPanel; the WorkersGUI sets up the GUI and maintains information concerning the complete GUI. The WorklistPanel represents the textfield for entering the new name for a new task, the combo box for selecting available jobs, and the actual button to execute this job.

     

    The most important method is the update() method, which updates the GUI whenever something which might affect the GUI happens. It looks a bit scary on a first glance since it needs to work in a multithreaded environment where updates might be issued concurrently from several threads. The most important part is computing enabled interactions and updating the enabledness of the "doJob" button correspondingly.

     

    Another important method is the exectue() method, which issues the execution of the respective interaction.

     

    These will be discussed in the tutorial in week 8.

     

  3. The probably easiest way to create a panel for cancelling jobs is to copy the WorklistPanel to a new class like CancelJobPanel, and then adjust it properly. The textfield can be deleted, the ComboBox can be made a ComboBox for selecting from all available jobs.

     

    The most important change is in the update() method: Here, an interaction for the selected job must be computed via the ECNO execution engine, and the enabledness of the button set accordingly. You can look up some snippets for doing this in the update() method of the class WorklistPanel; some details are discussed in the tutorial.

     

    The execute() method must be changed so that the interaction computed in the update() method is actually executed.

     

  4. You also need to adjust the class WorkersGUI where a new instance of CancelJobPanel should be initiallized. And all jobs that are reported to it via the addElement() and removeElement() methods need to be keep track of; and an update of the CancelJobPanel nees to be issued, whenever jobs are added or removed.

     

  5. Test whether your extended GUI works as expected by starting it as a Java application (if necessary in debug mode).

     

  6. You will realize that over time, the list of available jobs in the combo box becomes longer and longer, since all jobs the engine has ever seen are shown — the "cancel" button should be enabled only for the jobs that are still active, though.

     

    In order not to show the cancelled or finished jobs at the GUI anymore, you should update the ENCO net that defines the life-cycle of the job (in the file workers.pnml): Add some statement like engine.removeElement(self()); to the action of the two transitions that cancel or finish the job. Then non-active jobs should not show up any longer in the combo box for job selection (if the class WorkersGUI properly deals with this information).

     

  7. Optional (if you intend to do project 3): Once you have cancelled all jobs, you won't be able to create new jobs at all. Therefore, it would be nice to extend the GUI so that new jobs for some choosen workers could be created. You can do that programmatically.

     

 

Ekkart Kindler (), Feb 17, 2015