view flys-client/src/main/java/de/intevation/flys/client/client/ui/map/CapabilitiesPanel.java @ 5622:b28a6d05e969

Add a new mechanism in mapfish print call to add arbitary data maps Data properties are identified by starting with mapfish-data and they are then split in info value pairs where info can be the description of the information and value the value of the information to be transported in the data map.
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 09 Apr 2013 19:04:32 +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 :

http://dive4elements.wald.intevation.org