Mercurial > dive4elements > river
view flys-client/src/main/java/de/intevation/flys/client/client/ui/map/CapabilitiesPanel.java @ 4253:a1bc5b8cff0f
Refactor GaugePanel to create it's own SectionStackSection
The GaugePanel constructor now creates a SectionStackSection instead of
using a provided one.
Improve the rendering of the GaugePanel by having access to the SmartGWT wrapper
(WidgetCanvas) object for the GWT Tree (GaugeTree) directly.
Add methods to close and open the section. Also add a getter for the section.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Thu, 25 Oct 2012 13:52:58 +0200 |
parents | 3f15d9c22d53 |
children |
line wrap: on
line source
package de.intevation.flys.client.client.ui.map; import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.ui.Grid; import com.smartgwt.client.types.Overflow; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.Layout; import com.smartgwt.client.widgets.layout.VLayout; import de.intevation.flys.client.shared.model.Capabilities; import de.intevation.flys.client.shared.model.ContactInformation; import de.intevation.flys.client.client.FLYSConstants; public class CapabilitiesPanel extends VLayout { protected FLYSConstants MSG = GWT.create(FLYSConstants.class); protected Capabilities capabilites; public CapabilitiesPanel(Capabilities capabilites) { super(); this.capabilites = capabilites; initLayout(); } protected void initLayout() { setMargin(5); setOverflow(Overflow.AUTO); initContent(); } protected void initContent() { Grid grid = new Grid(10, 2); grid.setCellPadding(10); grid.setText(0, 0, MSG.capabilitiesTitle() + ":"); grid.setText(0, 1, capabilites.getTitle()); grid.setText(1, 0, MSG.capabilitiesURL() + ":"); grid.setText(1, 1, capabilites.getOnlineResource()); grid.setText(2, 0, MSG.capabilitiesAccessConstraints() + ":"); grid.setText(2, 1, capabilites.getAccessConstraints()); grid.setText(3, 0, MSG.capabilitiesFees() + ":"); grid.setText(3, 1, capabilites.getFees()); int row = 4; ContactInformation ci = capabilites.getContactInformation(); grid.setText(row, 0, MSG.capabilitiesContactInformation() + ":"); String person = ci.getPerson(); if (person != null && person.length() > 0) { grid.setText(row++, 1, person); } String organization = ci.getOrganization(); if (organization != null && organization.length() > 0) { grid.setText(row++, 1, organization); } String address = ci.getAddress(); if (address != null && address.length() > 0) { grid.setText(row++, 1, address); } String pc = ci.getPostcode(); String c = ci.getCity(); if ((pc != null && pc.length() > 0) || (c != null && c.length() > 0)) { grid.setText(row++, 1, pc + " " + c); } String email = ci.getEmail(); if (email != null && email.length() > 0) { grid.setText(row++, 1, MSG.capabilitiesEmail() + ": " + email); } String phone = ci.getPhone(); if (phone != null && phone.length() > 0) { grid.setText(row++, 1, MSG.capabilitiesPhone() + ": " + phone); } Label title = new Label(MSG.capabilitiesHint()); title.setHeight(25); title.setStyleName("capabilities-info-title"); addMember(title); addMember(grid); } protected Layout createRow(Label title, Label content) { title.setWidth(100); HLayout layout = new HLayout(); layout.addMember(title); layout.addMember(content); return layout; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :