The meta controller is indispensable to combine multiple shape manipulator. This controller allows you to give the control to other controllers and avoid concurrent problems between controllers in charge of the view.
Every mouse controller should implement the interface MouseHandler to work with the cg3DMetaManipulator.
This interface implements MouseListener, MouseWheelListener, MouseMotionListener. But return a Boolean in each of those functions. (Check Shape Manipulator for examples.)
When you add your controller to your MetaController, add the priority controllers first.
In the example below, Controller 1 is the first to be executed, so the first to add to our MetaController, Controller 2 in second place, and Controller 3 is the last to be added. Default Controller is the controller of MetaController.
When the function returns False, the function of the controller behind can be executed. And when it returns True, the function of the controller behind cannot be executed.
Here, all the mouseClicked functions are executed. But only mouseEntered of Controller1 is executed.
Sample Code
cgJOGL3DPlotView view = new cgJOGL3DPlotView();
//initialise metaController
metaController = new cg3DMetaManipulator(view);
//initialise controller1
cgInterfaceManipulator controller1 = new cgInterfaceManipulator(view);
//initialise controller2
cgCustomShapeManipulator controller2=new cgCustomShapeManipulator(view);
//initialise controller3
cgShapeManipulator controller3=new cgShapeManipulator(view);
//add controller1 to the metaController
metaController.addMouseHandler(controller1);
//add controller2 to the metaController
metaController.addMouseHandler(controller2);
//add controller3 to the metaController
metaController.addMouseHandler(controller3);
metaController.setEnabled(true);
//set the metaController
view.addMouseListener(metaController);
view.addMouseMotionListener(metaController);
view.addMouseWheelListener(metaController);