1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.vectomatic.svg.edit.client.gxt.binding;
19
20 import org.vectomatic.svg.edit.client.SvgrealApp;
21 import org.vectomatic.svg.edit.client.model.AbstractModel;
22
23 import com.extjs.gxt.ui.client.binding.FieldBinding;
24 import com.extjs.gxt.ui.client.data.ModelData;
25 import com.extjs.gxt.ui.client.widget.form.Field;
26 import com.google.gwt.core.client.GWT;
27
28
29
30
31
32
33 public abstract class DelayedBindingBase extends FieldBinding {
34 protected Object currentValue;
35
36 public DelayedBindingBase(Field<?> field, String property) {
37 super(field, property);
38 }
39
40 @Override
41 public void bind(ModelData model) {
42 super.bind(model);
43 currentValue = model.get(property);
44 }
45
46 @Override
47 public void updateModel() {
48 GWT.log("DelayedBindingBase.updateModel()");
49 Object val = field.getValue();
50 GWT.log("/\\/\\/\\/\\/\\/\\/\\/\\/\\ updateModel: " + val);
51 model.set(property, val);
52 if (SvgrealApp.getApp().getCommandFactorySelector().isSuspended()) {
53 currentValue = val;
54 }
55 }
56
57 protected void commitChanges() {
58 GWT.log("DelayedBindingBase.commitChanges: " + currentValue);
59 AbstractModel<?> amodel = (AbstractModel<?>)model;
60 amodel.setSilent(true);
61 model.set(property, currentValue);
62 amodel.setSilent(false);
63 super.updateModel();
64 currentValue = field.getValue();
65 }
66
67 }