Java Reference
In-Depth Information
The middle part is a panel for drawing the time plan. The activities are
represented as coloured rectangles (red, blue, etc; shown here in shades of
grey). The left and right extremes of a rectangle represent the activation and
termination time. Each activity is placed over a yellow (here, light grey) rec-
tangle whose left and right extremes represent the release time and due date
of the task. When the user moves the mouse pointer over an activity rectan-
gle, its temporal parameters are displayed in the corresponding areas of the
toolbar. The user can adjust the release time and due time parameters of an
activity by dragging the extremes of the corresponding yellow rectangle.
Figure 3.6 represents two groups of seven activities; each one is executed by
a resource (“R0” and “R1”). If we consider the scenario set in the fitness
club, the two resources might correspond to two athletes. Figure 3.6 does
not depict the training machines explicitly. This would require a more
complex and flexible GUI. Activities represented by rectangles of the same
colour are performed by the same machine. Thus, every machine is assigned
a different colour. Note that the figure represents the time plan as specified
in the problem formulation, that is the temporal and resource constraints are
not enforced yet. Finally, the lower part of the GUI draws the performance
graphics. Since the figure represents the situation before the execution of the
scheduling algorithm, the performance graphics are empty.
3.5.2
Design
The classical architecture of a GUI is structured in three layers: the model,
the view and the controller. The model includes the classes that manage the
data to be displayed. The view includes the visual components that make up
the GUI. The controller represents the top-level component that coordinates
the exchange of data between the model layer and the view layer.
The class diagram depicted in Figure 3.7 includes four new classes:
ScheduleManager , ScheduleCommand , ScheduleSheet and Schedule Performance .
Class ScheduleManager is the main class of the scheduler tool. The other
three represent the three parts of the graphical interface described in
Section 3.5.1.
3.5.3
Implementation
The implementation of the second prototype requires the definition of new
classes that implement the graphical user interface depicted in Figure 3.6
and a few changes in the implementation of class Scheduler and Activity .
ScheduleManager is a container class that represents the structure of the
graphical user interface and initializes the three graphical panels:
ScheduleCommand , SchedulePerformance and ScheduleSheet .
public class ScheduleManager extends JFrame {
HashMap problemList;
Scheduler scheduler # new Scheduler();
ScheduleSheet scheduleSheet;
 
Search WWH ::




Custom Search