Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RiverInfoPanel.java @ 7933:900299ab8e6e
Replaced plain gwt with smartgwt components in info panels.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Tue, 17 Jun 2014 09:45:48 +0200 |
parents | 720c5bbe2a16 |
children | 5e38e2924c07 |
comparison
equal
deleted
inserted
replaced
7932:b1393f96c153 | 7933:900299ab8e6e |
---|---|
8 | 8 |
9 package org.dive4elements.river.client.client.ui; | 9 package org.dive4elements.river.client.client.ui; |
10 | 10 |
11 import com.google.gwt.core.client.GWT; | 11 import com.google.gwt.core.client.GWT; |
12 import com.google.gwt.i18n.client.NumberFormat; | 12 import com.google.gwt.i18n.client.NumberFormat; |
13 import com.google.gwt.user.client.ui.HorizontalPanel; | 13 import com.smartgwt.client.types.Alignment; |
14 import com.google.gwt.user.client.ui.Label; | 14 import com.smartgwt.client.types.VerticalAlignment; |
15 import com.google.gwt.user.client.ui.Widget; | 15 import com.smartgwt.client.widgets.Label; |
16 import com.smartgwt.client.widgets.form.DynamicForm; | 16 import com.smartgwt.client.widgets.form.DynamicForm; |
17 | 17 import com.smartgwt.client.widgets.layout.HLayout; |
18 import java.util.Iterator; | |
19 | 18 |
20 import org.dive4elements.river.client.client.Config; | 19 import org.dive4elements.river.client.client.Config; |
21 import org.dive4elements.river.client.client.FLYS; | 20 import org.dive4elements.river.client.client.FLYS; |
22 import org.dive4elements.river.client.client.FLYSConstants; | 21 import org.dive4elements.river.client.client.FLYSConstants; |
23 import org.dive4elements.river.client.shared.model.RiverInfo; | 22 import org.dive4elements.river.client.shared.model.RiverInfo; |
24 | 23 |
25 /** | 24 /** |
26 * Panel to display information about a river. | 25 * Panel to display information about a river. |
27 * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a> | 26 * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a> |
28 */ | 27 */ |
29 public class RiverInfoPanel extends HorizontalPanel { | 28 public class RiverInfoPanel extends HLayout { |
30 | 29 |
31 /** The flys instance */ | 30 /** The flys instance */ |
32 protected FLYS flys; | 31 protected FLYS flys; |
33 | 32 |
34 /** The message class that provides i18n strings.*/ | 33 /** The message class that provides i18n strings.*/ |
41 | 40 |
42 public RiverInfoPanel(FLYS flys, RiverInfo riverinfo) { | 41 public RiverInfoPanel(FLYS flys, RiverInfo riverinfo) { |
43 this.flys = flys; | 42 this.flys = flys; |
44 | 43 |
45 setStyleName("riverinfopanel"); | 44 setStyleName("riverinfopanel"); |
46 setHeight("" + HEIGHT + "px"); | 45 setHeight(HEIGHT + "px"); |
47 setVerticalAlignment(ALIGN_MIDDLE); | 46 setAlign(VerticalAlignment.CENTER); |
48 | 47 setAlign(Alignment.LEFT); |
49 setRiverInfo(riverinfo); | 48 setRiverInfo(riverinfo); |
50 } | 49 } |
51 | 50 |
52 public void setRiverInfo(RiverInfo riverinfo) { | 51 public void setRiverInfo(RiverInfo riverinfo) { |
53 GWT.log("RiverInfoPanel - setRiverInfo"); | 52 GWT.log("RiverInfoPanel - setRiverInfo"); |
54 | 53 |
55 NumberFormat nf = NumberFormat.getDecimalFormat(); | 54 NumberFormat nf = NumberFormat.getDecimalFormat(); |
56 | 55 |
57 removeAllLabels(); | 56 //removeAllLabels(); |
58 | 57 |
59 addLabel(riverinfo.getName(), false); | 58 addLabel(riverinfo.getName(), false); |
60 | 59 |
61 String kmtext = ""; | 60 String kmtext = ""; |
62 Double start = riverinfo.getKmStart(); | 61 Double start = riverinfo.getKmStart(); |
99 MSG.gauge_river_url(); | 98 MSG.gauge_river_url(); |
100 String wikiBaseUrl = Config.getInstance().getWikiUrl(); | 99 String wikiBaseUrl = Config.getInstance().getWikiUrl(); |
101 DynamicForm infoLink = WikiLinks.linkDynamicForm(this.flys, wikiBaseUrl + url, | 100 DynamicForm infoLink = WikiLinks.linkDynamicForm(this.flys, wikiBaseUrl + url, |
102 MSG.gauge_river_info_link()); | 101 MSG.gauge_river_info_link()); |
103 infoLink.setTop(5); | 102 infoLink.setTop(5); |
104 add(infoLink); | 103 infoLink.setMargin(5); |
104 addMember(infoLink); | |
105 } | 105 } |
106 | 106 |
107 public static int getStaticHeight() { | 107 public static int getStaticHeight() { |
108 return RiverInfoPanel.HEIGHT + | 108 return RiverInfoPanel.HEIGHT + |
109 (2 * RiverInfoPanel.BORDER_WIDTH) + | 109 (2 * RiverInfoPanel.BORDER_WIDTH) + |
110 (2 * RiverInfoPanel.PADDING) + | 110 (2 * RiverInfoPanel.PADDING) + |
111 (2 * RiverInfoPanel.MARGIN); | 111 (2 * RiverInfoPanel.MARGIN); |
112 } | 112 } |
113 | 113 |
114 private void addLabel(String text, boolean wordwrap) { | 114 private void addLabel(String text, boolean wordwrap) { |
115 Label label = new Label(text, wordwrap); | 115 Label label = new Label("<span style='font-size:1.3em'>" + text + "</span>"); |
116 add(label); | 116 label.setWrap(wordwrap); |
117 setCellHeight(label, "" + HEIGHT + "px"); | 117 label.setMargin(5); |
118 } | 118 addMember(label); |
119 | |
120 private void removeAllLabels() { | |
121 GWT.log("RiverInfoPanel - removeAllLabels"); | |
122 | |
123 Iterator<Widget> it = this.iterator(); | |
124 while(it.hasNext()) { | |
125 it.next(); | |
126 it.remove(); | |
127 } | |
128 /* for (Widget wid: this) { */ | |
129 /* this.remove(wid); */ | |
130 /* } */ | |
131 } | 119 } |
132 } | 120 } |