Java Reference
In-Depth Information
try {
// links the supervisor to the MixerController
mixerController # (MixerInterface)
Naming.lookup
("//" ! mixerAddress ! "/MixerTankController");
} catch (Exception e) { e.printStackTrace(); }
initGUI();
}
// the methods used to set the paint tonality
void redSlider_stateChanged(ChangeEvent e) {
colorPanel.setColor('r', redSlider.getValue());
}
...
// the method used to open the spray pump
void setButton_actionPerformed(ActionEvent e) {
try {
flowSlider.setValue(0);
mixerController.setColor(colorPanel.color[0],
colorPanel.color[1], colorPanel.color[2]);
// waits for the drain pump to close
while (! mixerController.colorReady())
Thread.sleep(100);
} catch (Exception ex) { ex.printStackTrace(); }
}
void flowSlider_mouseReleased(MouseEvent e) {
try {
mixerController.openPump
("PumpA", flowSlider.getValue());
} catch (RemoteException re) { re.printStackTrace(); }
}
}
13.6.4
Test
The last test case verifies the functionalities of the supervisory console and
of the mixer controller using the simulator GUI (see Figure 13.13), and in
particular:
Colour selection. The selected colour should correspond to the tonality of
the paint in the mixture tank.
Paint mixing. When the “Set Color” button is pressed, the mixture tank
should first be emptied and then filled with paint corresponding to the
selected colour. During this phase, the technician is not allowed to change
colour or to open the spray pump.
Spraying. The output flow of the spray pump should be proportional to the
state value of the “Flow” slider button. When the mixture tank starts
 
Search WWH ::




Custom Search