/* LayerChangeListener */
/* ---------------------------------------------------------------------- */
@Override
public void activeLayerChange(Layer oldLayer, Layer newLayer) {
if (oldLayer instanceof OsmDataLayer) {
OsmDataLayer l = (OsmDataLayer)oldLayer;
l.data.removeDataSetListener(this);
}
if (!(newLayer instanceof OsmDataLayer)) {
latest = null;
fireModelChange();
return;
}
OsmDataLayer l = (OsmDataLayer)newLayer;
l.data.addDataSetListener(this);
OsmPrimitive primitive = l.data.getPrimitiveById(history.getId(), history.getType());
HistoryOsmPrimitive latest;
if (canShowAsLatest(primitive)) {
latest = new HistoryPrimitiveBuilder().build(primitive);