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 |
|
10 private Image m_image; |
|
11 HLayout m_row; |
|
12 |
|
13 public void setHandelReg(HandlerRegistration m_handelReg) { |
|
14 this.m_handelReg = m_handelReg; |
|
15 } |
|
16 |
|
17 private HandlerRegistration m_handelReg; |
|
18 |
|
19 public MyLoadHandler(HLayout row, Image image) { |
|
20 m_image = image; |
|
21 m_row = row; |
|
22 } |
|
23 |
|
24 @Override |
|
25 public void onLoad(LoadEvent event) { |
|
26 |
|
27 setDimensions(m_row, m_image.getHeight(), m_image.getWidth()); |
|
28 if (m_handelReg != null) |
|
29 m_handelReg.removeHandler(); |
|
30 } |
|
31 |
|
32 private void setDimensions(HLayout row, int height, int width) { |
|
33 final int minHeight = 30; |
|
34 row.setHeight(height < minHeight ? minHeight : height); |
|
35 row.setWidth(width); |
|
36 } |
|
37 |
|
38 } |