diff gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTableEditPanel.java @ 9070:611a523fc42f

VegetationZoneAccessHelper, VegetationTablePanels verbessert
author gernotbelger
date Tue, 15 May 2018 18:04:36 +0200
parents 1ffd38826175
children 41f4bc83aa7a
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTableEditPanel.java	Tue May 15 12:00:26 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTableEditPanel.java	Tue May 15 18:04:36 2018 +0200
@@ -15,7 +15,6 @@
 import com.smartgwt.client.types.ListGridFieldType;
 import com.smartgwt.client.widgets.Button;
 import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Label;
 import com.smartgwt.client.widgets.events.ClickEvent;
 import com.smartgwt.client.widgets.events.ClickHandler;
 import com.smartgwt.client.widgets.form.DynamicForm;
@@ -27,26 +26,20 @@
 import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
 import com.smartgwt.client.widgets.layout.HLayout;
 
-public class VegetationzonesTableEditPanel extends SuperVegZonesTablePanel {
+public class VegetationzonesTableEditPanel extends AbstractVegZonesTablePanel {
     private static final long serialVersionUID = 1L;
 
     @Override
     public Canvas createWidget(final DataList data) {
-
+        super.createTable(data, 450);
+        this.vegzone = PanelHelper.createItem("uinfo_vegetation_zone_label", this.MSG.uinfo_vegetation_zone_label(), 200, new IsStringValidator());
+        this.start = PanelHelper.createItem("uinfo_vegetation_zones_from", this.MSG.uinfo_vegetation_zones_from(), 40, new IsIntegerValidator());
+        this.end = PanelHelper.createItem("uinfo_vegetation_zones_to", this.MSG.uinfo_vegetation_zones_to(), 40, new IsIntegerValidator());
         final HLayout fields = new HLayout();
         final HLayout fields2 = new HLayout();
 
         final Button add = new Button(this.MSG.add_date()); // TODO: make key more generic or change to more specific
 
-        data.add(VegetationzonesTablePanel.getDummyData());
-
-        final Label title = new Label(data.get(0).getDescription());
-        title.setHeight("35px"); // orig:25
-
-        this.vegzone = PanelHelper.createItem("uinfo_vegetation_zone_label", this.MSG.uinfo_vegetation_zone_label(), 200, new IsStringValidator());
-        this.start = PanelHelper.createItem("uinfo_vegetation_zones_from", this.MSG.uinfo_vegetation_zones_from(), 40, new IsIntegerValidator());
-        this.end = PanelHelper.createItem("uinfo_vegetation_zones_to", this.MSG.uinfo_vegetation_zones_to(), 40, new IsIntegerValidator());
-
         final DynamicForm form1 = new DynamicForm();
         final DynamicForm form2 = new DynamicForm();
         form2.setNumCols(5);
@@ -81,23 +74,6 @@
             }
         });
 
-        final Label sel = new Label(this.MSG.select());
-        sel.setHeight(25);
-        this.elements.setWidth(450); // 185
-        this.elements.setHeight(300); // 120
-        this.elements.setShowHeaderContextMenu(false);
-        this.elements.setCanReorderFields(false);
-        this.elements.setCanSort(false);
-        this.elements.setCanEdit(false);
-        final ListGridField vegzone = new ListGridField("vegzone", this.MSG.uinfo_vegetation_zones_label());
-        final ListGridField from = new ListGridField("from", this.MSG.uinfo_vegetation_zones_from());
-        final ListGridField to = new ListGridField("to", this.MSG.uinfo_vegetation_zones_to());
-        vegzone.setWidth(285);
-        from.setWidth(70);
-        to.setWidth(70);
-
-        addDataInit(data);
-
         final ListGridField removeField = new ListGridField("_removeRecord", "Remove Record") {
             {
                 setType(ListGridFieldType.ICON);
@@ -122,16 +98,11 @@
             }
         });
 
-        this.elements.setFields(vegzone, from, to, removeField);
+        this.elements.setFields(super.vegzoneField, super.fromField, super.toField, removeField);
 
         fields.addMember(form1);
         fields2.addMember(form2);
 
-        this.tableLayout.addMember(this.elements);
-        this.root.addMember(title);
-        this.root.addMember(this.input);
-        this.root.addMember(this.tableLayout);
-        this.root.addMember(PanelHelper.getSpacer(10));
         this.root.addMember(fields);
         this.root.addMember(fields2);
         this.root.addMember(PanelHelper.getSpacer(10));

http://dive4elements.wald.intevation.org