Mercurial > dive4elements > river
comparison flys-client/src/main/java/org/dive4elements/river/client/client/ui/map/CapabilitiesPanel.java @ 5834:f507086aa94b
Repaired internal references.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 12:31:32 +0200 |
parents | flys-client/src/main/java/de/intevation/flys/client/client/ui/map/CapabilitiesPanel.java@3f15d9c22d53 |
children | 821a02bbfb4e |
comparison
equal
deleted
inserted
replaced
5833:a2bdc0f524e8 | 5834:f507086aa94b |
---|---|
1 package de.intevation.flys.client.client.ui.map; | |
2 | |
3 import com.google.gwt.core.client.GWT; | |
4 import com.google.gwt.user.client.ui.Grid; | |
5 | |
6 import com.smartgwt.client.types.Overflow; | |
7 import com.smartgwt.client.widgets.Label; | |
8 import com.smartgwt.client.widgets.layout.HLayout; | |
9 import com.smartgwt.client.widgets.layout.Layout; | |
10 import com.smartgwt.client.widgets.layout.VLayout; | |
11 | |
12 import de.intevation.flys.client.shared.model.Capabilities; | |
13 import de.intevation.flys.client.shared.model.ContactInformation; | |
14 import de.intevation.flys.client.client.FLYSConstants; | |
15 | |
16 | |
17 public class CapabilitiesPanel extends VLayout { | |
18 | |
19 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); | |
20 | |
21 protected Capabilities capabilites; | |
22 | |
23 | |
24 public CapabilitiesPanel(Capabilities capabilites) { | |
25 super(); | |
26 this.capabilites = capabilites; | |
27 | |
28 initLayout(); | |
29 } | |
30 | |
31 | |
32 protected void initLayout() { | |
33 setMargin(5); | |
34 setOverflow(Overflow.AUTO); | |
35 initContent(); | |
36 } | |
37 | |
38 | |
39 protected void initContent() { | |
40 Grid grid = new Grid(10, 2); | |
41 grid.setCellPadding(10); | |
42 | |
43 grid.setText(0, 0, MSG.capabilitiesTitle() + ":"); | |
44 grid.setText(0, 1, capabilites.getTitle()); | |
45 grid.setText(1, 0, MSG.capabilitiesURL() + ":"); | |
46 grid.setText(1, 1, capabilites.getOnlineResource()); | |
47 grid.setText(2, 0, MSG.capabilitiesAccessConstraints() + ":"); | |
48 grid.setText(2, 1, capabilites.getAccessConstraints()); | |
49 grid.setText(3, 0, MSG.capabilitiesFees() + ":"); | |
50 grid.setText(3, 1, capabilites.getFees()); | |
51 | |
52 int row = 4; | |
53 | |
54 ContactInformation ci = capabilites.getContactInformation(); | |
55 | |
56 grid.setText(row, 0, MSG.capabilitiesContactInformation() + ":"); | |
57 | |
58 String person = ci.getPerson(); | |
59 if (person != null && person.length() > 0) { | |
60 grid.setText(row++, 1, person); | |
61 } | |
62 | |
63 String organization = ci.getOrganization(); | |
64 if (organization != null && organization.length() > 0) { | |
65 grid.setText(row++, 1, organization); | |
66 } | |
67 | |
68 String address = ci.getAddress(); | |
69 if (address != null && address.length() > 0) { | |
70 grid.setText(row++, 1, address); | |
71 } | |
72 | |
73 String pc = ci.getPostcode(); | |
74 String c = ci.getCity(); | |
75 if ((pc != null && pc.length() > 0) || (c != null && c.length() > 0)) { | |
76 grid.setText(row++, 1, pc + " " + c); | |
77 } | |
78 | |
79 String email = ci.getEmail(); | |
80 if (email != null && email.length() > 0) { | |
81 grid.setText(row++, 1, MSG.capabilitiesEmail() + ": " + email); | |
82 } | |
83 | |
84 String phone = ci.getPhone(); | |
85 if (phone != null && phone.length() > 0) { | |
86 grid.setText(row++, 1, MSG.capabilitiesPhone() + ": " + phone); | |
87 } | |
88 | |
89 Label title = new Label(MSG.capabilitiesHint()); | |
90 title.setHeight(25); | |
91 title.setStyleName("capabilities-info-title"); | |
92 | |
93 addMember(title); | |
94 addMember(grid); | |
95 } | |
96 | |
97 | |
98 protected Layout createRow(Label title, Label content) { | |
99 title.setWidth(100); | |
100 | |
101 HLayout layout = new HLayout(); | |
102 layout.addMember(title); | |
103 layout.addMember(content); | |
104 | |
105 return layout; | |
106 } | |
107 } | |
108 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |