Managing selection between views

ILcdSelection allows you to select domain objects from a model contained in a layer. Consider this case:

  • Multiple views share the same ILcdModel but do not share the layer that contains the model.

Layers cannot be shared between Lightspeed views.

  • A change in object selection occurs in one of the layers.

You must notify all layers containing the same model of the change, and call the method selectObject on these layers to synchronize the selection.

The utility class TLcdSelectionMediator provides a convenient way to handle selection among ILcdLayered objects, or views. You need to initialize the class with two arrays of ILcdLayered objects. One array acts as a master or source and contains all the ILcdLayered objects that listen to selection changes in the ILcdLayer objects it contains. The other array acts as a slave and contains all the ILcdLayered objects that must be synchronized upon a selection change in one of the master objects. The selection of a layer that belongs to a slave ILcdLayered is updated if that layer refers to the same ILcdModel.

To keep views synchronized constantly, you can select the same array to act as master and slave.