public void setSelectionEnabled ( boolean selectionEnabled ) { // Clean up first! Otherwise the handler list would just keep on growing. if ( selectionRegistration != null ) { selectionRegistration . removeHandler ( ) ; selectionRegistration = null ; } if ( gridSelectionRegistration != null ) { gridSelectionRegistration . removeHandler ( ) ; gridSelectionRegistration = null ; } this . selectionEnabled = selectionEnabled ; // If enabled renew the handlers, and adjust grid selection type: if ( selectionEnabled ) { setAttribute ( "selectionType" , SelectionStyle . MULTIPLE . getValue ( ) , true ) ; selectionRegistration = mapModel . addFeatureSelectionHandler ( this ) ; gridSelectionRegistration = addSelectionChangedHandler ( this ) ; } else { setAttribute ( "selectionType" , SelectionStyle . NONE . getValue ( ) , true ) ; } }
Adds or removes this widget as a handler for selection onto the MapModel . What this means is that when selection is enabled selected rows in the grid will result in selected features in the MapModel and vice versa .