view gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/InundationWMSInputPanel.java @ 9661:9b8ba3b83a15

Importer (s/u-info) vegetation zones: new database column in vegetation_type table for german type name, localized vegetation type names by querying the database instead of translating by resource property, detecting and cancelling the import of a second vegetation zone file for a river, detecting, logging, cancelling in case of wrong column titles, detecting, logging and ignoring lines with missing (color) values, comparing vegetation zone name and class with the database and logging+ignoring in case of inconsistencies, starting the most elevated zone with 0 instead of -1 overflow days
author mschaefer
date Mon, 23 Mar 2020 16:38:12 +0100
parents ba0561906f81
children
line wrap: on
line source
/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU AGPL (>=v3)
 * and comes with ABSOLUTELY NO WARRANTY! Check out the
 * documentation coming with Dive4Elements River for details.
 */

package org.dive4elements.river.client.client.ui.uinfo;

import org.dive4elements.river.client.client.FLYSConstants;
import org.dive4elements.river.client.client.ui.AbstractSingleItemPanel;
import org.dive4elements.river.client.shared.model.DataList;

import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.layout.VLayout;

public class InundationWMSInputPanel extends AbstractSingleItemPanel {

    private static final long serialVersionUID = 1L;
    private final boolean isEditable;
    private final String dataKey;
    private final String appendString;

    public InundationWMSInputPanel(final FLYSConstants msg, final String dataKey, final String titleForCreateOld, final String appendString,
            final boolean isEditable) {
        super(new UinfoInundationSingleYearEpochBehaviour(appendString, msg, titleForCreateOld));
        this.isEditable = isEditable;
        this.dataKey = dataKey;
        this.appendString = appendString;
    }

    @Override
    protected String getDatakey() {
        return this.dataKey;
    }

    @Override
    protected String errorForItemMsg() {
        return this.MSG.no_data_for_input();
    }

    @Override
    public Canvas createWidget(final DataList data) {
        final VLayout layout = new VLayout();

        final Label title = new Label(data.get(0).getDescription());
        title.setHeight("25px");

        final DynamicForm form = new DynamicForm();
        form.setNumCols(4);

        final TextItem inputItem = createInputItem("INPUT");
        inputItem.setWidth(250);
        inputItem.setCanEdit(this.isEditable);

        inputItem.setShowTitle(false);

        if (this.appendString != null) {

            final StaticTextItem fromText = new StaticTextItem("staticAppend");
            fromText.setValue(this.appendString);
            fromText.setShowTitle(false);
            form.setFields(inputItem, fromText);
        } else {
            form.setFields(inputItem);
        }

        layout.addMember(title);
        layout.addMember(form);

        return layout;
    }

}

http://dive4elements.wald.intevation.org