comparison 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
comparison
equal deleted inserted replaced
9069:1ffd38826175 9070:611a523fc42f
13 13
14 import com.google.gwt.core.client.GWT; 14 import com.google.gwt.core.client.GWT;
15 import com.smartgwt.client.types.ListGridFieldType; 15 import com.smartgwt.client.types.ListGridFieldType;
16 import com.smartgwt.client.widgets.Button; 16 import com.smartgwt.client.widgets.Button;
17 import com.smartgwt.client.widgets.Canvas; 17 import com.smartgwt.client.widgets.Canvas;
18 import com.smartgwt.client.widgets.Label;
19 import com.smartgwt.client.widgets.events.ClickEvent; 18 import com.smartgwt.client.widgets.events.ClickEvent;
20 import com.smartgwt.client.widgets.events.ClickHandler; 19 import com.smartgwt.client.widgets.events.ClickHandler;
21 import com.smartgwt.client.widgets.form.DynamicForm; 20 import com.smartgwt.client.widgets.form.DynamicForm;
22 import com.smartgwt.client.widgets.form.validator.IsIntegerValidator; 21 import com.smartgwt.client.widgets.form.validator.IsIntegerValidator;
23 import com.smartgwt.client.widgets.form.validator.IsStringValidator; 22 import com.smartgwt.client.widgets.form.validator.IsStringValidator;
25 import com.smartgwt.client.widgets.grid.ListGridRecord; 24 import com.smartgwt.client.widgets.grid.ListGridRecord;
26 import com.smartgwt.client.widgets.grid.events.RecordClickEvent; 25 import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
27 import com.smartgwt.client.widgets.grid.events.RecordClickHandler; 26 import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
28 import com.smartgwt.client.widgets.layout.HLayout; 27 import com.smartgwt.client.widgets.layout.HLayout;
29 28
30 public class VegetationzonesTableEditPanel extends SuperVegZonesTablePanel { 29 public class VegetationzonesTableEditPanel extends AbstractVegZonesTablePanel {
31 private static final long serialVersionUID = 1L; 30 private static final long serialVersionUID = 1L;
32 31
33 @Override 32 @Override
34 public Canvas createWidget(final DataList data) { 33 public Canvas createWidget(final DataList data) {
35 34 super.createTable(data, 450);
35 this.vegzone = PanelHelper.createItem("uinfo_vegetation_zone_label", this.MSG.uinfo_vegetation_zone_label(), 200, new IsStringValidator());
36 this.start = PanelHelper.createItem("uinfo_vegetation_zones_from", this.MSG.uinfo_vegetation_zones_from(), 40, new IsIntegerValidator());
37 this.end = PanelHelper.createItem("uinfo_vegetation_zones_to", this.MSG.uinfo_vegetation_zones_to(), 40, new IsIntegerValidator());
36 final HLayout fields = new HLayout(); 38 final HLayout fields = new HLayout();
37 final HLayout fields2 = new HLayout(); 39 final HLayout fields2 = new HLayout();
38 40
39 final Button add = new Button(this.MSG.add_date()); // TODO: make key more generic or change to more specific 41 final Button add = new Button(this.MSG.add_date()); // TODO: make key more generic or change to more specific
40
41 data.add(VegetationzonesTablePanel.getDummyData());
42
43 final Label title = new Label(data.get(0).getDescription());
44 title.setHeight("35px"); // orig:25
45
46 this.vegzone = PanelHelper.createItem("uinfo_vegetation_zone_label", this.MSG.uinfo_vegetation_zone_label(), 200, new IsStringValidator());
47 this.start = PanelHelper.createItem("uinfo_vegetation_zones_from", this.MSG.uinfo_vegetation_zones_from(), 40, new IsIntegerValidator());
48 this.end = PanelHelper.createItem("uinfo_vegetation_zones_to", this.MSG.uinfo_vegetation_zones_to(), 40, new IsIntegerValidator());
49 42
50 final DynamicForm form1 = new DynamicForm(); 43 final DynamicForm form1 = new DynamicForm();
51 final DynamicForm form2 = new DynamicForm(); 44 final DynamicForm form2 = new DynamicForm();
52 form2.setNumCols(5); 45 form2.setNumCols(5);
53 form1.setNumCols(7); 46 form1.setNumCols(7);
79 r.setAttribute("to", v2); 72 r.setAttribute("to", v2);
80 VegetationzonesTableEditPanel.this.elements.addData(r); 73 VegetationzonesTableEditPanel.this.elements.addData(r);
81 } 74 }
82 }); 75 });
83 76
84 final Label sel = new Label(this.MSG.select());
85 sel.setHeight(25);
86 this.elements.setWidth(450); // 185
87 this.elements.setHeight(300); // 120
88 this.elements.setShowHeaderContextMenu(false);
89 this.elements.setCanReorderFields(false);
90 this.elements.setCanSort(false);
91 this.elements.setCanEdit(false);
92 final ListGridField vegzone = new ListGridField("vegzone", this.MSG.uinfo_vegetation_zones_label());
93 final ListGridField from = new ListGridField("from", this.MSG.uinfo_vegetation_zones_from());
94 final ListGridField to = new ListGridField("to", this.MSG.uinfo_vegetation_zones_to());
95 vegzone.setWidth(285);
96 from.setWidth(70);
97 to.setWidth(70);
98
99 addDataInit(data);
100
101 final ListGridField removeField = new ListGridField("_removeRecord", "Remove Record") { 77 final ListGridField removeField = new ListGridField("_removeRecord", "Remove Record") {
102 { 78 {
103 setType(ListGridFieldType.ICON); 79 setType(ListGridFieldType.ICON);
104 setIcon(GWT.getHostPageBaseURL() + VegetationzonesTableEditPanel.this.MSG.removeFeature()); 80 setIcon(GWT.getHostPageBaseURL() + VegetationzonesTableEditPanel.this.MSG.removeFeature());
105 setCanEdit(false); 81 setCanEdit(false);
120 } 96 }
121 event.getViewer().removeData(event.getRecord()); 97 event.getViewer().removeData(event.getRecord());
122 } 98 }
123 }); 99 });
124 100
125 this.elements.setFields(vegzone, from, to, removeField); 101 this.elements.setFields(super.vegzoneField, super.fromField, super.toField, removeField);
126 102
127 fields.addMember(form1); 103 fields.addMember(form1);
128 fields2.addMember(form2); 104 fields2.addMember(form2);
129 105
130 this.tableLayout.addMember(this.elements);
131 this.root.addMember(title);
132 this.root.addMember(this.input);
133 this.root.addMember(this.tableLayout);
134 this.root.addMember(PanelHelper.getSpacer(10));
135 this.root.addMember(fields); 106 this.root.addMember(fields);
136 this.root.addMember(fields2); 107 this.root.addMember(fields2);
137 this.root.addMember(PanelHelper.getSpacer(10)); 108 this.root.addMember(PanelHelper.getSpacer(10));
138 this.root.addMember(add); 109 this.root.addMember(add);
139 this.root.addMember(PanelHelper.getSpacer(20)); 110 this.root.addMember(PanelHelper.getSpacer(20));

http://dive4elements.wald.intevation.org