comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java @ 1421:d50c3262e638

Reorder the map themes at the end of the layer initialization to be in sync with the map theme panel. flys-client/trunk@3358 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 06 Dec 2011 09:08:48 +0000
parents 6a7cfe9d87fe
children 25be27e33b77
comparison
equal deleted inserted replaced
1420:c8481debff70 1421:d50c3262e638
15 import com.smartgwt.client.widgets.menu.Menu; 15 import com.smartgwt.client.widgets.menu.Menu;
16 import com.smartgwt.client.widgets.menu.MenuItem; 16 import com.smartgwt.client.widgets.menu.MenuItem;
17 import com.smartgwt.client.widgets.menu.events.ClickHandler; 17 import com.smartgwt.client.widgets.menu.events.ClickHandler;
18 import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent; 18 import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
19 19
20 import org.gwtopenmaps.openlayers.client.Map;
21 import org.gwtopenmaps.openlayers.client.layer.Layer;
22
20 import de.intevation.flys.client.shared.MapUtils; 23 import de.intevation.flys.client.shared.MapUtils;
21 import de.intevation.flys.client.shared.model.AttributedTheme; 24 import de.intevation.flys.client.shared.model.AttributedTheme;
22 import de.intevation.flys.client.shared.model.Collection; 25 import de.intevation.flys.client.shared.model.Collection;
23 import de.intevation.flys.client.shared.model.FacetRecord; 26 import de.intevation.flys.client.shared.model.FacetRecord;
24 import de.intevation.flys.client.shared.model.Theme; 27 import de.intevation.flys.client.shared.model.Theme;
193 oldRecords = list.getRecords(); 196 oldRecords = list.getRecords();
194 super.clearGrid(); 197 super.clearGrid();
195 } 198 }
196 199
197 200
201 /**
202 * This method calls super.updateGrid() at first. Finally, it is used to
203 * reorder the layers in the map. The first layer added to the map is the
204 * layer which is least visible. So, the order needs to be reflected.
205 */
206 @Override
207 protected void updateGrid() {
208 super.updateGrid();
209
210 Map map = mapOut.getMap();
211 int num = map.getNumLayers() - 1; // without the vector layer
212
213 Layer[] layers = map.getLayers();
214
215 for (int i = 1; i < num; i++) {
216 map.raiseLayer(layers[i], num-i);
217 }
218 }
219
220
198 @Override 221 @Override
199 protected void addFacetRecord(FacetRecord rec) { 222 protected void addFacetRecord(FacetRecord rec) {
200 Theme newTheme = rec.getTheme(); 223 Theme newTheme = rec.getTheme();
201 boolean isNew = true; 224 boolean isNew = true;
202 225

http://dive4elements.wald.intevation.org