1 11 12 package org.eclipse.jface.internal.databinding.provisional; 13 14 import java.util.HashMap ; 15 import java.util.Map ; 16 17 import org.eclipse.jface.internal.databinding.provisional.observable.IDiff; 18 import org.eclipse.jface.internal.databinding.provisional.observable.IObservable; 19 import org.eclipse.jface.internal.databinding.provisional.validation.ValidationError; 20 21 27 public class BindingEvent { 28 38 public BindingEvent(IObservable model, IObservable target, IDiff diff, int copyType, 39 int pipelinePosition) { 40 this.model = model; 41 this.target = target; 42 this.diff = diff; 43 this.copyType = copyType; 44 this.pipelinePosition = pipelinePosition; 45 createSymbolTable(); 46 } 47 48 51 public final IObservable model; 52 53 56 public final IObservable target; 57 58 62 public final IDiff diff; 63 64 68 public final int copyType; 69 70 80 public int pipelinePosition; 81 82 85 public ValidationError validationError; 86 87 92 public Object originalValue = null; 93 94 101 public Object convertedValue = null; 102 103 107 public static final int EVENT_COPY_TO_TARGET = 0; 108 109 113 public static final int EVENT_COPY_TO_MODEL = 1; 114 115 119 public static final int EVENT_PARTIAL_VALIDATE = 2; 120 121 125 public static final int EVENT_REMOVE = 3; 126 127 131 public static final int PIPELINE_AFTER_GET = 0; 132 133 138 public static final int PIPELINE_AFTER_VALIDATE = 1; 139 140 144 public static final int PIPELINE_AFTER_CONVERT = 2; 145 146 150 public static final int PIPELINE_AFTER_BUSINESS_VALIDATE = 3; 151 152 156 public static final int PIPELINE_AFTER_CHANGE = 4; 157 158 162 public static final int PIPELINE_VALIDATION_ERROR_OR_WARNING = 5; 163 164 168 public final Map pipelineConstants = new HashMap (); 169 private HashMap eventConstants = new HashMap (); 170 171 174 private void createSymbolTable() { 175 eventConstants.put(new Integer (0), "EVENT_COPY_TO_TARGET"); eventConstants.put(new Integer (1), "EVENT_COPY_TO_MODEL"); eventConstants.put(new Integer (2), "EVENT_PARTIAL_VALIDATE"); eventConstants.put(new Integer (3), "EVENT_REMOVE"); 180 pipelineConstants.put(new Integer (0), "PIPELINE_AFTER_GET"); pipelineConstants.put(new Integer (1), "PIPELINE_AFTER_VALIDATE"); pipelineConstants.put(new Integer (2), "PIPELINE_AFTER_CONVERT"); pipelineConstants.put(new Integer (3), 184 "PIPELINE_AFTER_BUSINESS_VALIDATE"); pipelineConstants.put(new Integer (4), "PIPELINE_AFTER_CHANGE"); } 187 188 193 public String toString() { 194 StringBuffer result = new StringBuffer (); 195 result.append("(" + eventConstants.get(new Integer (copyType)) + ", "); result.append(pipelineConstants.get(new Integer (pipelinePosition))); 197 result.append("): Diff(" + diff + ")"); return result.toString(); 199 } 200 201 } 202 | Popular Tags |