Mercurial > dive4elements > river
view gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTableEditPanel.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 | 8cf2968dd4f9 |
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.ui.PanelHelper; import org.dive4elements.river.client.shared.model.DataList; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.ui.Button; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.ColorItem; import com.smartgwt.client.widgets.form.fields.TextItem; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridRecord; import com.smartgwt.client.widgets.layout.Layout; import com.smartgwt.client.widgets.layout.VLayout; public class VegetationzonesTableEditPanel extends AbstractVegZonesTablePanel { private static final long serialVersionUID = 1L; private TextItem vegzone; private TextItem start; private TextItem end; @Override public void createWidget(final Layout root, final DataList data) { final ListGrid elements = super.createTable(root, data, "420", true); this.vegzone = PanelHelper.createItem("uinfo_vegetation_zone_label", this.MSG.uinfo_vegetation_zone_label(), "*"); this.vegzone.setColSpan(4); this.start = PanelHelper.createIntegerItem("uinfo_vegetation_zones_from", this.MSG.uinfo_vegetation_zones_from(), "*"); this.end = PanelHelper.createIntegerItem("uinfo_vegetation_zones_to", this.MSG.uinfo_vegetation_zones_to(), "*"); final VLayout fields = new VLayout(); final ColorItem colorPicker = new ColorItem(); colorPicker.setTitle(this.MSG.uinfo_vegetation_zone_color()); colorPicker.setShowTitle(true); colorPicker.setShowValueIconOnly(false); colorPicker.setShowPickerIcon(true); colorPicker.setColSpan(2); colorPicker.setWidth(110); final Button add = new Button(this.MSG.add_date()); // TODO: make key more generic or change to more specific final DynamicForm form1 = new DynamicForm(); form1.setNumCols(5); // für Layout untereinander muss 2 eingestellt werden form1.setFields(this.vegzone, this.start, this.end, colorPicker); add.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent ce) { handleAddClicked(elements, colorPicker); } }); fields.addMember(form1); root.addMember(fields); root.addMember(PanelHelper.getSpacer(10)); root.addMember(add); } protected void handleAddClicked(final ListGrid elements, final ColorItem colorPicker) { final String v1 = VegetationzonesTableEditPanel.this.start.getValueAsString(); final String v2 = VegetationzonesTableEditPanel.this.end.getValueAsString(); final String v3 = VegetationzonesTableEditPanel.this.vegzone.getValueAsString(); final String v4 = colorPicker.getValueAsString(); final String message = validate(v1, v2, v3, v4); if (message != null) { SC.warn(message); return; } final ListGridRecord r = new ListGridRecord(); r.setAttribute("vegzone", v3); r.setAttribute("from", v1); r.setAttribute("to", v2); r.setAttribute("color", v4); elements.addData(r); updateValidationMsgLabel(); final String sortField = elements.getSortField(); if (sortField != null) { elements.toggleSort(sortField); elements.toggleSort(sortField); // HACK. has to be. otherwise normalizer won't be called :-( } } @Override protected Canvas createHelper(final DataList data) { return null; } }