code: public void selectLayer(Layer<?> layer) {
  		if (layer == null) {
  			deselectLayer(this.getSelectedLayer());
  		} else {
  			Layer<?> selLayer = this.getSelectedLayer();
  			if (selLayer != null && !layer.getId().equals(selLayer.getId())) {
  				deselectLayer(selLayer);
  			}
  			layer.setSelected(true);
  			handlerManager.fireEvent(new LayerSelectedEvent(layer));
  		}
  	}
docs: Select a new layer. Only one layer can be selected at a time, so this function first tries to deselect the
  currently selected (if there is one).
  
  @param layer
  The layer to select. If layer is null, then the currently selected layer will be deselected!