Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/PanelHelper.java @ 9237:972e10522ed6
salix.supraregional ui
author | gernotbelger |
---|---|
date | Tue, 10 Jul 2018 11:24:12 +0200 |
parents | 431f1c269be5 |
children | d89976700474 |
comparison
equal
deleted
inserted
replaced
9236:b515ed950d39 | 9237:972e10522ed6 |
---|---|
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | 7 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
8 * documentation coming with Dive4Elements River for details. | 8 * documentation coming with Dive4Elements River for details. |
9 */ | 9 */ |
10 package org.dive4elements.river.client.client.ui; | 10 package org.dive4elements.river.client.client.ui; |
11 | 11 |
12 import com.smartgwt.client.types.Alignment; | |
13 import com.smartgwt.client.types.ListGridFieldType; | |
12 import com.smartgwt.client.widgets.form.fields.IntegerItem; | 14 import com.smartgwt.client.widgets.form.fields.IntegerItem; |
13 import com.smartgwt.client.widgets.form.fields.TextItem; | 15 import com.smartgwt.client.widgets.form.fields.TextItem; |
16 import com.smartgwt.client.widgets.form.validator.IntegerRangeValidator; | |
14 import com.smartgwt.client.widgets.form.validator.IsIntegerValidator; | 17 import com.smartgwt.client.widgets.form.validator.IsIntegerValidator; |
15 import com.smartgwt.client.widgets.form.validator.Validator; | 18 import com.smartgwt.client.widgets.form.validator.Validator; |
19 import com.smartgwt.client.widgets.grid.ListGrid; | |
20 import com.smartgwt.client.widgets.grid.ListGridField; | |
21 import com.smartgwt.client.widgets.grid.SortNormalizer; | |
22 import com.smartgwt.client.widgets.grid.events.RecordClickEvent; | |
23 import com.smartgwt.client.widgets.grid.events.RecordClickHandler; | |
16 import com.smartgwt.client.widgets.layout.VLayout; | 24 import com.smartgwt.client.widgets.layout.VLayout; |
17 | 25 |
18 /** | 26 /** |
19 * @author Domenico Nardi Tironi | 27 * @author Domenico Nardi Tironi |
20 * | 28 * |
61 inputItem.setValidators(new IsIntegerValidator()); // Validator hat keinen sichtbaren Effekt. | 69 inputItem.setValidators(new IsIntegerValidator()); // Validator hat keinen sichtbaren Effekt. |
62 inputItem.setWidth(60); | 70 inputItem.setWidth(60); |
63 return inputItem; | 71 return inputItem; |
64 | 72 |
65 } | 73 } |
74 | |
75 public static final ListGridField createRemoveField(final ListGrid table, final String icon) { | |
76 final ListGridField removeField = new ListGridField("_removeRecord", "Remove Record") { | |
77 { | |
78 setType(ListGridFieldType.ICON); | |
79 setIcon(icon); | |
80 setCanEdit(false); | |
81 setCanFilter(false); | |
82 setCanSort(false); | |
83 setCanGroupBy(false); | |
84 setCanFreeze(false); | |
85 setWidth(25); | |
86 setCanDragResize(false); | |
87 super.setCanToggle(false); | |
88 } | |
89 }; | |
90 table.addRecordClickHandler(new RecordClickHandler() { | |
91 @Override | |
92 public void onRecordClick(final RecordClickEvent event) { | |
93 // Just handle remove-clicks | |
94 if (!event.getField().getName().equals(removeField.getName())) { | |
95 return; | |
96 } | |
97 event.getViewer().removeData(event.getRecord()); | |
98 } | |
99 }); | |
100 | |
101 return removeField; | |
102 } | |
103 | |
104 public static final ListGridField createIntTableField(final String key, final String msg, final boolean canSort, final SortNormalizer normalizer, | |
105 final IntegerRangeValidator validators) { | |
106 final ListGridField intField = new ListGridField(key, msg); | |
107 intField.setType(ListGridFieldType.INTEGER); | |
108 intField.setValidators(validators); | |
109 intField.setWidth(90); | |
110 intField.setAlign(Alignment.RIGHT); | |
111 intField.setSortNormalizer(normalizer); | |
112 intField.setCanSort(canSort); | |
113 intField.setCanDragResize(false); | |
114 | |
115 return intField; | |
116 } | |
117 | |
66 } | 118 } |