9481
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
|
2 * Software engineering by Intevation GmbH |
|
3 * |
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
|
6 * documentation coming with Dive4Elements River for details. |
|
7 */ |
|
8 |
|
9 package org.dive4elements.river.client.client.ui.uinfo; |
|
10 |
|
11 import org.dive4elements.river.client.client.FLYSConstants; |
|
12 import org.dive4elements.river.client.client.ui.AbstractSingleItemPanel; |
|
13 import org.dive4elements.river.client.shared.model.DataList; |
|
14 |
|
15 import com.smartgwt.client.widgets.Canvas; |
|
16 import com.smartgwt.client.widgets.Label; |
|
17 import com.smartgwt.client.widgets.form.DynamicForm; |
|
18 import com.smartgwt.client.widgets.form.fields.TextItem; |
|
19 import com.smartgwt.client.widgets.layout.VLayout; |
|
20 |
|
21 public class InundationWMSInputPanel extends AbstractSingleItemPanel { |
|
22 |
|
23 private static final long serialVersionUID = 1L; |
|
24 private final boolean isEditable; |
|
25 |
|
26 public InundationWMSInputPanel(final FLYSConstants msg, final String titleForCreateOld, final boolean isEditable) { |
|
27 super(new UinfoInundationSingleYearEpochBehaviour(msg, titleForCreateOld)); |
|
28 this.isEditable = isEditable; |
|
29 } |
|
30 |
|
31 @Override |
|
32 protected String getDatakey() { |
|
33 return "year_epoch_select"; |
|
34 } |
|
35 |
|
36 @Override |
|
37 protected String errorForItemMsg() { |
|
38 return this.MSG.no_data_for_input(); |
|
39 } |
|
40 |
|
41 @Override |
|
42 public Canvas createWidget(final DataList data) { |
|
43 final VLayout layout = new VLayout(); |
|
44 |
|
45 final Label title = new Label(data.get(0).getDescription()); |
|
46 title.setHeight("25px"); |
|
47 |
|
48 final DynamicForm form = new DynamicForm(); |
|
49 form.setNumCols(4); |
|
50 |
|
51 final TextItem inputItem = createInputItem("INPUT"); |
|
52 inputItem.setWidth(250); |
|
53 inputItem.setCanEdit(this.isEditable); |
|
54 inputItem.setShowTitle(false); |
|
55 form.setFields(inputItem); |
|
56 |
|
57 layout.addMember(title); |
|
58 layout.addMember(form); |
|
59 |
|
60 return layout; |
|
61 } |
|
62 |
|
63 } |