1 12 13 package org.eclipse.core.databinding; 14 15 import org.eclipse.core.databinding.observable.IObservable; 16 import org.eclipse.core.databinding.observable.value.IObservableValue; 17 18 25 public abstract class Binding { 26 27 protected DataBindingContext context; 28 private IObservable target; 29 private IObservable model; 30 31 37 public Binding(IObservable target, IObservable model) { 38 this.target = target; 39 this.model = model; 40 } 41 42 51 public final void init(DataBindingContext context) { 52 this.context = context; 53 preInit(); 54 context.addBinding(this); 55 postInit(); 56 } 57 58 65 protected abstract void preInit(); 66 67 73 protected abstract void postInit(); 74 75 78 public abstract IObservableValue getValidationStatus(); 79 80 85 public abstract void updateTargetToModel(); 86 87 92 public abstract void updateModelToTarget(); 93 94 99 public abstract void validateTargetToModel(); 100 101 106 public abstract void validateModelToTarget(); 107 108 111 public void dispose() { 112 if (context != null) { 113 context.removeBinding(this); 114 } 115 context = null; 116 target = null; 117 model = null; 118 disposed = true; 119 } 120 121 protected boolean disposed = false; 122 123 126 public boolean isDisposed() { 127 return disposed; 128 } 129 130 133 void setDataBindingContext(DataBindingContext context) { 134 this.context = context; 135 } 136 137 140 public IObservable getTarget() { 141 return target; 142 } 143 144 147 public IObservable getModel() { 148 return model; 149 } 150 } 151 | Popular Tags |