9698
|
1 package org.dive4elements.river.client.client.ui.map; |
|
2 |
|
3 import com.google.gwt.event.dom.client.LoadEvent; |
|
4 import com.google.gwt.event.shared.HandlerRegistration; |
|
5 import com.google.gwt.user.client.ui.Image; |
|
6 import com.smartgwt.client.widgets.layout.HLayout; |
|
7 |
|
8 public class MyLoadHandler implements com.google.gwt.event.dom.client.LoadHandler { |
|
9 private Image m_image; |
9699
|
10 private HLayout m_row; |
9698
|
11 private HandlerRegistration m_handelReg; |
|
12 |
|
13 public MyLoadHandler(HLayout row, Image image) { |
|
14 m_image = image; |
|
15 m_row = row; |
9699
|
16 m_handelReg = image.addLoadHandler(this); |
9698
|
17 } |
|
18 |
|
19 @Override |
|
20 public void onLoad(LoadEvent event) { |
|
21 setDimensions(m_row, m_image.getHeight(), m_image.getWidth()); |
|
22 if (m_handelReg != null) |
|
23 m_handelReg.removeHandler(); |
|
24 } |
9699
|
25 |
9698
|
26 private void setDimensions(HLayout row, int height, int width) { |
|
27 final int minHeight = 30; |
|
28 row.setHeight(height < minHeight ? minHeight : height); |
|
29 row.setWidth(width); |
|
30 } |
9699
|
31 } |