Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/client/widgets/KMSpinner.java @ 7982:b1ff606f01ee
Fixed some smartgwt 4.1 related issues.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Tue, 01 Jul 2014 13:11:43 +0200 |
parents | ea9eef426962 |
children | f7f86f4e4c8d |
comparison
equal
deleted
inserted
replaced
7980:cacff0246a81 | 7982:b1ff606f01ee |
---|---|
10 | 10 |
11 import com.google.gwt.core.client.GWT; | 11 import com.google.gwt.core.client.GWT; |
12 import com.google.gwt.i18n.client.NumberFormat; | 12 import com.google.gwt.i18n.client.NumberFormat; |
13 | 13 |
14 import com.smartgwt.client.data.Record; | 14 import com.smartgwt.client.data.Record; |
15 import com.smartgwt.client.types.Alignment; | |
16 import com.smartgwt.client.types.VerticalAlignment; | |
15 import com.smartgwt.client.widgets.Button; | 17 import com.smartgwt.client.widgets.Button; |
16 import com.smartgwt.client.widgets.Label; | 18 import com.smartgwt.client.widgets.Label; |
17 import com.smartgwt.client.widgets.events.ClickEvent; | 19 import com.smartgwt.client.widgets.events.ClickEvent; |
18 import com.smartgwt.client.widgets.form.DynamicForm; | 20 import com.smartgwt.client.widgets.form.DynamicForm; |
19 import com.smartgwt.client.widgets.form.FormItemValueFormatter; | 21 import com.smartgwt.client.widgets.form.FormItemValueFormatter; |
45 super(2); | 47 super(2); |
46 this.facetRecord = facetRecord; | 48 this.facetRecord = facetRecord; |
47 this.value = initialValue; | 49 this.value = initialValue; |
48 | 50 |
49 setWidth("99%"); | 51 setWidth("99%"); |
50 setHeight(18); | 52 setHeight(24); |
51 | 53 |
52 // minusButton shall ask service for previous available cs. | 54 // minusButton shall ask service for previous available cs. |
53 Button minusButton = new Button("-"); | 55 Button minusButton = new Button("-"); |
54 minusButton.setWidth(18); | 56 minusButton.setWidth(18); |
55 minusButton.setHeight(18); | 57 minusButton.setHeight(22); |
58 minusButton.setValign(VerticalAlignment.CENTER); | |
56 minusButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { | 59 minusButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { |
57 public void onClick(ClickEvent evt) { | 60 public void onClick(ClickEvent evt) { |
58 fireChangedEvent(value - 0.1d, false); | 61 fireChangedEvent(value - 0.1d, false); |
59 } | 62 } |
60 }); | 63 }); |
62 DynamicForm form = new DynamicForm(); | 65 DynamicForm form = new DynamicForm(); |
63 final TextItem kmField = new TextItem(); | 66 final TextItem kmField = new TextItem(); |
64 kmField.setValue(initialValue); | 67 kmField.setValue(initialValue); |
65 kmField.setWidth("*"); | 68 kmField.setWidth("*"); |
66 kmField.setTitle(""); | 69 kmField.setTitle(""); |
67 kmField.setHeight(16); | 70 kmField.setHeight(20); |
68 | 71 |
69 FormItemValueFormatter doubleFormat = new FormItemValueFormatter() { | 72 FormItemValueFormatter doubleFormat = new FormItemValueFormatter() { |
70 public String formatValue(Object value, Record record, DynamicForm form, FormItem item) { | 73 public String formatValue(Object value, Record record, DynamicForm form, FormItem item) { |
71 if (value != null) { | 74 if (value != null) { |
72 NumberFormat nf = NumberFormat.getDecimalFormat(); | 75 NumberFormat nf = NumberFormat.getDecimalFormat(); |
132 form.setTitle(""); | 135 form.setTitle(""); |
133 form.setTitlePrefix(""); | 136 form.setTitlePrefix(""); |
134 form.setTitleSuffix(""); | 137 form.setTitleSuffix(""); |
135 form.setTitleWidth(0); | 138 form.setTitleWidth(0); |
136 form.setWidth(50); | 139 form.setWidth(50); |
137 form.setHeight(18); | |
138 | 140 |
139 // PlusButton shall ask service for next available cs. | 141 // PlusButton shall ask service for next available cs. |
140 Button plusButton = new Button("+"); | 142 Button plusButton = new Button("+"); |
141 plusButton.setWidth(18); | 143 plusButton.setWidth(18); |
142 plusButton.setHeight(18); | 144 plusButton.setHeight(22); |
145 plusButton.setValign(VerticalAlignment.CENTER); | |
143 plusButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { | 146 plusButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { |
144 public void onClick(ClickEvent evt) { | 147 public void onClick(ClickEvent evt) { |
145 fireChangedEvent(value + 0.1d, true); | 148 fireChangedEvent(value + 0.1d, true); |
146 } | 149 } |
147 }); | 150 }); |
148 | 151 |
152 this.setMembersMargin(5); | |
149 this.addMember(minusButton); | 153 this.addMember(minusButton); |
150 this.addMember(form); | 154 this.addMember(form); |
151 this.addMember(plusButton); | 155 this.addMember(plusButton); |
152 } | 156 } |
153 | 157 |