Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/map/MyLoadHandler.java @ 9699:94362af5928e
refactoring
author | dnt_bjoernsen <d.tironi@bjoernsen.de> |
---|---|
date | Wed, 20 Jan 2021 18:30:26 +0100 |
parents | 812a6a3eaaf5 |
children |
comparison
equal
deleted
inserted
replaced
9698:812a6a3eaaf5 | 9699:94362af5928e |
---|---|
4 import com.google.gwt.event.shared.HandlerRegistration; | 4 import com.google.gwt.event.shared.HandlerRegistration; |
5 import com.google.gwt.user.client.ui.Image; | 5 import com.google.gwt.user.client.ui.Image; |
6 import com.smartgwt.client.widgets.layout.HLayout; | 6 import com.smartgwt.client.widgets.layout.HLayout; |
7 | 7 |
8 public class MyLoadHandler implements com.google.gwt.event.dom.client.LoadHandler { | 8 public class MyLoadHandler implements com.google.gwt.event.dom.client.LoadHandler { |
9 | |
10 private Image m_image; | 9 private Image m_image; |
11 HLayout m_row; | 10 private HLayout m_row; |
12 | |
13 public void setHandelReg(HandlerRegistration m_handelReg) { | |
14 this.m_handelReg = m_handelReg; | |
15 } | |
16 | |
17 private HandlerRegistration m_handelReg; | 11 private HandlerRegistration m_handelReg; |
18 | 12 |
19 public MyLoadHandler(HLayout row, Image image) { | 13 public MyLoadHandler(HLayout row, Image image) { |
20 m_image = image; | 14 m_image = image; |
21 m_row = row; | 15 m_row = row; |
16 m_handelReg = image.addLoadHandler(this); | |
22 } | 17 } |
23 | 18 |
24 @Override | 19 @Override |
25 public void onLoad(LoadEvent event) { | 20 public void onLoad(LoadEvent event) { |
26 | |
27 setDimensions(m_row, m_image.getHeight(), m_image.getWidth()); | 21 setDimensions(m_row, m_image.getHeight(), m_image.getWidth()); |
28 if (m_handelReg != null) | 22 if (m_handelReg != null) |
29 m_handelReg.removeHandler(); | 23 m_handelReg.removeHandler(); |
30 } | 24 } |
31 | 25 |
32 private void setDimensions(HLayout row, int height, int width) { | 26 private void setDimensions(HLayout row, int height, int width) { |
33 final int minHeight = 30; | 27 final int minHeight = 30; |
34 row.setHeight(height < minHeight ? minHeight : height); | 28 row.setHeight(height < minHeight ? minHeight : height); |
35 row.setWidth(width); | 29 row.setWidth(width); |
36 } | 30 } |
37 | |
38 } | 31 } |