1 19 package org.netbeans.modules.xml.xam.spi; 20 21 import org.netbeans.modules.xml.xam.Component; 22 import org.netbeans.modules.xml.xam.Model; 23 import org.netbeans.modules.xml.xam.spi.Validation.ValidationType; 24 25 26 37 38 public interface Validator { 39 40 44 String getName(); 45 46 47 48 55 ValidationResult validate(Model model, Validation validation, 56 ValidationType validationType); 57 58 59 enum ResultType { 60 ADVICE, WARNING, ERROR 61 } 62 63 public class ResultItem { 64 private Validator validator; 65 private ResultType type; 66 private Component component = null; 67 private String description; 68 private int lineNumber = -1; 69 private int columnNumber = -1; 70 private Model model; 71 72 79 public ResultItem(Validator validator, ResultType type, Component component, 80 String desc) { 81 this.validator = validator; 82 this.type = type; 83 this.component = component; 84 this.description = desc; 85 this.model = component.getModel(); 86 } 87 88 89 98 public ResultItem(Validator validator, ResultType type, 99 String desc, int lineNumber, int columnNumber, Model model) { 100 this.validator = validator; 101 this.type = type; 102 this.description = desc; 103 this.lineNumber = lineNumber; 104 this.columnNumber = columnNumber; 105 this.model = model; 106 } 107 108 109 113 public Validator getValidator() { 114 return validator; 115 } 116 117 121 public ResultType getType() { 122 return type; 123 } 124 125 132 public Component getComponents() { 133 return component; 134 } 135 136 140 public String getDescription() { 141 return description; 142 } 143 144 150 public int getLineNumber() { 151 return lineNumber; 152 } 153 154 160 public int getColumnNumber() { 161 return columnNumber; 162 } 163 164 168 public Model getModel() { 169 return model; 170 } 171 172 } 173 } 174 | Popular Tags |