Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapPanel.java @ 4570:8ca06d3040d0
flys-client: Map.updateSize() is now called on every windows movement
which fixes the cursor offset problem (flys/#422).
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Tue, 20 Nov 2012 14:30:33 +0100 |
parents | fac54b8470d4 |
children | 95e23bcf6a50 |
comparison
equal
deleted
inserted
replaced
4569:276d9bd3c77d | 4570:8ca06d3040d0 |
---|---|
1 package de.intevation.flys.client.client.ui.map; | 1 package de.intevation.flys.client.client.ui.map; |
2 | 2 |
3 import com.google.gwt.core.client.GWT; | 3 import com.google.gwt.core.client.GWT; |
4 | 4 import com.smartgwt.client.widgets.Canvas; |
5 import com.smartgwt.client.widgets.WidgetCanvas; | |
6 import com.smartgwt.client.widgets.events.ParentMovedEvent; | |
7 import com.smartgwt.client.widgets.events.ParentMovedHandler; | |
5 import com.smartgwt.client.widgets.events.ResizedEvent; | 8 import com.smartgwt.client.widgets.events.ResizedEvent; |
6 import com.smartgwt.client.widgets.events.ResizedHandler; | 9 import com.smartgwt.client.widgets.events.ResizedHandler; |
7 import com.smartgwt.client.widgets.layout.VLayout; | 10 import com.smartgwt.client.widgets.layout.VLayout; |
8 | 11 |
9 import de.intevation.flys.client.shared.model.BBox; | 12 import de.intevation.flys.client.shared.model.BBox; |
50 | 53 |
51 addMember(toolbar); | 54 addMember(toolbar); |
52 addMember(floodMapWidget); | 55 addMember(floodMapWidget); |
53 | 56 |
54 addResizedHandler(new ResizedHandler() { | 57 addResizedHandler(new ResizedHandler() { |
55 | |
56 @Override | 58 @Override |
57 public void onResized(ResizedEvent event) { | 59 public void onResized(ResizedEvent event) { |
58 doLayout(); | 60 doLayout(); |
59 } | 61 } |
60 }); | 62 }); |
63 | |
64 addParentMovedHandler(new ParentMovedHandler() { | |
65 @Override | |
66 public void onParentMoved(ParentMovedEvent event) { | |
67 floodMapWidget.getMap().updateSize(); | |
68 } | |
69 }); | |
61 } | 70 } |
62 | 71 |
72 /** | |
73 * Due to the fact that SmartGWT Layout misses a removeMember(Widget) | |
74 * method we use this method to remove all WidgetCanvas members. | |
75 * WidgetCanvas is the wrapper class used by Layout to handle Widget | |
76 * objects. | |
77 */ | |
78 protected void removeWidgetCanvasMember() { | |
79 Canvas[] allCanvas = getMembers(); | |
80 for (Canvas canvas : allCanvas) { | |
81 if (canvas instanceof WidgetCanvas) { | |
82 removeMember(canvas); | |
83 } | |
84 } | |
85 } | |
63 | 86 |
64 protected void doLayout() { | 87 protected void doLayout() { |
65 int width = getWidth(); | 88 int width = getWidth(); |
66 int height = getHeight(); | 89 int height = getHeight(); |
67 GWT.log("MapPanel.size: " + width + "x" + height); | 90 GWT.log("MapPanel.size: " + width + "x" + height); |
68 | 91 |
69 width -= 2; // minus black borders | 92 width -= 2; // minus black borders |
70 height -= toolbar.getHeight() + 4; | 93 height -= toolbar.getHeight() + 4; |
71 | 94 |
95 // Recreate Map widget | |
96 /*removeWidgetCanvasMember(); | |
97 floodMap.recreateWidget(width, height); | |
98 floodMapWidget = floodMap.getMapWidget(); | |
99 addMember(floodMapWidget); | |
100 */ | |
72 floodMapWidget.setSize(Integer.toString(width), Integer.toString(height)); | 101 floodMapWidget.setSize(Integer.toString(width), Integer.toString(height)); |
73 floodMapWidget.getMap().updateSize(); | 102 floodMapWidget.getMap().updateSize(); |
74 } | 103 } |
75 | 104 |
76 | 105 |