| | 1176 | public interface ComponentErrorEvent extends Terminal.ErrorEvent { |
| | 1177 | } |
| | 1178 | |
| | 1179 | public interface ComponentErrorHandler { |
| | 1180 | /** |
| | 1181 | * Handle the component error |
| | 1182 | * |
| | 1183 | * @param event |
| | 1184 | * @return True if the error has been handled False, otherwise |
| | 1185 | */ |
| | 1186 | public boolean handleComponentError(ComponentErrorEvent event); |
| | 1187 | } |
| | 1188 | |
| | 1189 | /** |
| | 1190 | * Gets the error handler for the component. |
| | 1191 | * |
| | 1192 | * The error handler is dispatched whenever there is an error processing the |
| | 1193 | * data coming from the client. |
| | 1194 | * |
| | 1195 | * @return |
| | 1196 | */ |
| | 1197 | public ComponentErrorHandler getErrorHandler() { |
| | 1198 | return errorHandler; |
| | 1199 | } |
| | 1200 | |
| | 1201 | /** |
| | 1202 | * Sets the error handler for the component. |
| | 1203 | * |
| | 1204 | * The error handler is dispatched whenever there is an error processing the |
| | 1205 | * data coming from the client. |
| | 1206 | * |
| | 1207 | * If the error handler is not set, the application error handler is used to |
| | 1208 | * handle the exception. |
| | 1209 | * |
| | 1210 | * @param errorHandler |
| | 1211 | * AbstractField specific error handler |
| | 1212 | */ |
| | 1213 | public void setErrorHandler(ComponentErrorHandler errorHandler) { |
| | 1214 | this.errorHandler = errorHandler; |
| | 1215 | } |
| | 1216 | |
| | 1217 | public boolean handleError(ComponentErrorEvent error) { |
| | 1218 | if (errorHandler != null) { |
| | 1219 | return errorHandler.handleComponentError(error); |
| | 1220 | } |
| | 1221 | return false; |
| | 1222 | |
| | 1223 | } |
| | 1224 | |