Beispiel #1
0
 /**
  * Registers a controller to an Active object. If the controller extends KeyboardVivaeController
  * it also registers it to the parent component as a new KeyListener.
  *
  * @param agent The Active the controller will control.
  * @param controller The controller specifing behavior of the Active object.
  */
 public void registerController(Active agent, VivaeController controller) {
   controller.setControlledObject(agent);
   controllers.add(controller);
   if (agent instanceof Robot && controller instanceof KeyboardVivaeController) {
     if (parent != null) parent.addKeyListener((KeyboardVivaeController) controller);
     this.addKeyListener((KeyboardVivaeController) controller);
   }
 }
Beispiel #2
0
 /**
  * Registers a controller to an Active object. If the controller extends KeyboardVivaeController
  * it also registers it to the parent component as a new KeyListener.
  *
  * @param agent The Active the controller will control.
  * @param controller The controller specifing behavior of the Active object.
  */
 public void registerController(IRobotInterface agent, VivaeController controller) {
   controller.setControlledObject(agent);
   controllers.add(controller);
   if (agent instanceof VivaeRobotRepresent && controller instanceof KeyboardVivaeController) {
     if (parent != null) {
       parent.addKeyListener((KeyboardVivaeController) controller);
     }
     this.addKeyListener((KeyboardVivaeController) controller);
   }
 }