Revision 37204 branches/dal_time_support/libraries/libFMap_mapcontext/src/org/gvsig/fmap/mapcontext/MapContext.java
MapContext.java | ||
---|---|---|
1289 | 1289 |
|
1290 | 1290 |
// Registramos al FMap como listener del legend de las capas |
1291 | 1291 |
FLayer lyr = e.getAffectedLayer(); |
1292 |
selectionListener(lyr); |
|
1293 |
if (lyr instanceof SingleLayer){ |
|
1294 |
if (((SingleLayer) lyr).getDataStore() != null) { |
|
1295 |
((SingleLayer) lyr).getDataStore().addObserver( |
|
1296 |
MapContext.this); |
|
1297 |
} |
|
1298 |
} |
|
1292 |
addSelectionListener(lyr); |
|
1299 | 1293 |
} |
1300 | 1294 |
|
1301 |
/** |
|
1302 |
* <p>Registers an event buffer as a listener for all layers as argument.</p> |
|
1303 |
* |
|
1304 |
* <p>Each {@link FLayer FLayer} of this map must have an event buffer for all kind |
|
1305 |
* of specific listeners of that layer. This method distinguish between {@link Classifiable Classifiable}, |
|
1306 |
* {@link AlphanumericData AlphanumericData}, and {@link FLayers FLayers} layers, and for each one, |
|
1307 |
* registers, for their specific listeners, the <code>eventBuffer</code> as a listener.</p> |
|
1308 |
* |
|
1309 |
* @param the layer or layers |
|
1310 |
*/ |
|
1311 |
private void selectionListener(FLayer lyr){ |
|
1312 |
lyr.addLayerListener(eventBuffer); |
|
1313 |
|
|
1314 |
if (lyr instanceof Classifiable) { |
|
1315 |
Classifiable c = (Classifiable) lyr; |
|
1316 |
c.addLegendListener(eventBuffer); |
|
1317 |
} |
|
1318 |
|
|
1319 |
if (lyr instanceof FLayers){ |
|
1320 |
FLayers lyrs=(FLayers)lyr; |
|
1321 |
for(int i=0;i<lyrs.getLayersCount();i++){ |
|
1322 |
selectionListener(lyrs.getLayer(i)); |
|
1323 |
} |
|
1324 |
} |
|
1325 |
|
|
1326 |
} |
|
1327 | 1295 |
/* |
1328 | 1296 |
* @see com.iver.cit.gvsig.fmap.layers.LayerCollectionListener#layerMoved(com.iver.cit.gvsig.fmap.layers.LayerPositionEvent) |
1329 | 1297 |
*/ |
... | ... | |
1605 | 1573 |
layers.addLayerCollectionListener(eventBuffer); |
1606 | 1574 |
layers.setProjection(vp.getProjection()); |
1607 | 1575 |
|
1608 |
|
|
1576 |
//Add the listener for the selection |
|
1577 |
addSelectionListener(layers); |
|
1609 | 1578 |
} |
1610 | 1579 |
|
1611 | 1580 |
private void loadLayers(FLayers lyrs) { |
... | ... | |
1647 | 1616 |
dispose(layers); |
1648 | 1617 |
dispose(tracLayer); |
1649 | 1618 |
} |
1619 |
|
|
1620 |
/** |
|
1621 |
* <p>Registers an event buffer as a listener for all layers as argument.</p> |
|
1622 |
* |
|
1623 |
* <p>Each {@link FLayer FLayer} of this map must have an event buffer for all kind |
|
1624 |
* of specific listeners of that layer. This method distinguish between {@link Classifiable Classifiable}, |
|
1625 |
* {@link AlphanumericData AlphanumericData}, and {@link FLayers FLayers} layers, and for each one, |
|
1626 |
* registers, for their specific listeners, the <code>eventBuffer</code> as a listener.</p> |
|
1627 |
* |
|
1628 |
* @param the layer or layers |
|
1629 |
*/ |
|
1630 |
private void addSelectionListener(FLayer lyr){ |
|
1631 |
lyr.addLayerListener(eventBuffer); |
|
1632 |
|
|
1633 |
if (lyr instanceof Classifiable) { |
|
1634 |
Classifiable c = (Classifiable) lyr; |
|
1635 |
c.addLegendListener(eventBuffer); |
|
1636 |
} |
|
1637 |
|
|
1638 |
if (lyr instanceof FLayers){ |
|
1639 |
FLayers lyrs=(FLayers)lyr; |
|
1640 |
for(int i=0;i<lyrs.getLayersCount();i++){ |
|
1641 |
addSelectionListener(lyrs.getLayer(i)); |
|
1642 |
} |
|
1643 |
} |
|
1644 |
if (lyr instanceof SingleLayer){ |
|
1645 |
if (((SingleLayer) lyr).getDataStore() != null) { |
|
1646 |
((SingleLayer) lyr).getDataStore().addObserver( |
|
1647 |
MapContext.this); |
|
1648 |
} |
|
1649 |
} |
|
1650 |
} |
|
1650 | 1651 |
} |
Also available in: Unified diff