Changeset 5250

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

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

Location:
trunk/src/com/itmill/toolkit
Files:
4 modified

Legend:

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

    r5242 r5250  
    10891089                    .println("Warning: SocketException in CommunicationManager." 
    10901090                            + " Most likely client (browser) closed socket."); 
    1091  
    1092         } else { 
    1093             // throw it to standard error stream too 
    1094             t.printStackTrace(); 
     1091            return; 
    10951092        } 
    10961093 
     
    11161113                        .setComponentError(new SystemError(e)); 
    11171114            } 
     1115        } else { 
     1116            /* 
     1117             * Can't show it to the user in any way so we print to standard 
     1118             * error 
     1119             */ 
     1120            t.printStackTrace(); 
     1121 
    11181122        } 
    11191123    } 
  • trunk/src/com/itmill/toolkit/terminal/gwt/server/ChangeVariablesErrorEvent.java

    r5242 r5250  
    44 
    55import com.itmill.toolkit.ui.Component; 
    6 import com.itmill.toolkit.ui.AbstractField.ComponentErrorEvent; 
     6import com.itmill.toolkit.ui.AbstractComponent.ComponentErrorEvent; 
    77 
    88public class ChangeVariablesErrorEvent implements ComponentErrorEvent { 
  • 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} 
  • trunk/src/com/itmill/toolkit/ui/AbstractField.java

    r5242 r5250  
    2222import com.itmill.toolkit.terminal.PaintException; 
    2323import com.itmill.toolkit.terminal.PaintTarget; 
    24 import com.itmill.toolkit.terminal.Terminal; 
    2524 
    2625/** 
     
    123122    private boolean validationVisible = true; 
    124123 
    125     private ComponentErrorHandler errorHandler = null; 
    126  
    127124    /* Component basics ************************************************ */ 
    128125 
     
    10861083    } 
    10871084 
    1088     public interface ComponentErrorHandler { 
    1089         /** 
    1090          * Handle the component error 
    1091          *  
    1092          * @param event 
    1093          * @return True if the error has been handled False, otherwise 
    1094          */ 
    1095         public boolean handleComponentError(ComponentErrorEvent event); 
    1096     } 
    1097  
    1098     /** 
    1099      * Gets the error handler for the component. 
    1100      *  
    1101      * The error handler is dispatched whenever there is an error processing the 
    1102      * data coming from the client. 
    1103      *  
    1104      * @return 
    1105      */ 
    1106     public ComponentErrorHandler getErrorHandler() { 
    1107         return errorHandler; 
    1108     } 
    1109  
    1110     /** 
    1111      * Sets the error handler for the component. 
    1112      *  
    1113      * The error handler is dispatched whenever there is an error processing the 
    1114      * data coming from the client. 
    1115      *  
    1116      * If the error handler is not set, the application error handler is used to 
    1117      * handle the exception. 
    1118      *  
    1119      * @param errorHandler 
    1120      *                AbstractField specific error handler 
    1121      */ 
    1122     public void setErrorHandler(ComponentErrorHandler errorHandler) { 
    1123         this.errorHandler = errorHandler; 
    1124     } 
    1125  
    1126     public boolean handleError(ComponentErrorEvent error) { 
    1127         if (errorHandler != null) { 
    1128             return errorHandler.handleComponentError(error); 
    1129         } 
    1130         return false; 
    1131  
    1132     } 
    1133  
    11341085    /** 
    11351086     * Sets the current buffered source exception. 
     
    11431094    } 
    11441095 
    1145     public interface ComponentErrorEvent extends Terminal.ErrorEvent { 
    1146     } 
    1147  
    11481096}