[Schmitzm-commits] r2311 - trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/gui

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Thu May 23 15:38:13 CEST 2013


Author: mojays
Date: 2013-05-23 15:38:13 +0200 (Thu, 23 May 2013)
New Revision: 2311

Modified:
   trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/gui/MapContextControlPane.java
Log:
MapContextControlPane: WorkAround for "bug" in GT2.7.5; MapLayerListEvent does not support "fromIndex" correctly for layerMoved-event

Modified: trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/gui/MapContextControlPane.java
===================================================================
--- trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/gui/MapContextControlPane.java	2013-05-23 13:36:21 UTC (rev 2310)
+++ trunk/schmitzm-gt/src/main/java/de/schmitzm/geotools/gui/MapContextControlPane.java	2013-05-23 13:38:13 UTC (rev 2311)
@@ -281,8 +281,18 @@
 
 					@Override
 					public void layerMoved(MapLayerListEvent e) {
-						int from = convertIndex(e.getFromIndex());
+					    // Bug (?) in MapContent (GT2.7.5):
+  					    //   MapLayerListEvent wird nur mit "toIndex" instanziiert, so dass
+  					    //   immer e.getFromIndex() == e.getToIndex()
+					    // Quick-And-Dirty-Fix: alle Komponenten durchsuchen, bis die zum
+					    //                      Layer passende gefunden wird
+//						int from = convertIndex(e.getFromIndex());
+					    int from = 0;
+					    for (from = 0; from < getComponentCount(); from++)
+					      if ( ((MapLayerControl)getComponent(from)).layer.equals( e.getLayer()) )
+					        break;
 						int to = convertIndex(e.getToIndex());
+						
 						moveLayerControl(from, to);
 					}
 



More information about the Schmitzm-commits mailing list