Show
Ignore:
Timestamp:
08/25/08 05:59:54 (5 months ago)
Author:
artur.signell@…
Message:

Made #1642 fix more generic by moving implementation to AbstractComponent?

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/com/itmill/toolkit/ui/AbstractComponent.java

    r5235 r5250  
    2020import com.itmill.toolkit.terminal.PaintTarget; 
    2121import com.itmill.toolkit.terminal.Resource; 
     22import com.itmill.toolkit.terminal.Terminal; 
    2223 
    2324/** 
     
    121122    private int widthUnit = UNITS_PIXELS; 
    122123    private int heightUnit = UNITS_PIXELS; 
     124 
     125    private ComponentErrorHandler errorHandler = null; 
    123126 
    124127    /* Constructor */ 
     
    11711174    } 
    11721175 
     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 
    11731225}