Subversion Repositories eFlore/Applications.coel

Rev

Rev 1509 | Rev 1784 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
10 jpm 1
package org.tela_botanica.client;
2
 
51 jpm 3
import com.extjs.gxt.ui.client.GXT;
10 jpm 4
import com.google.gwt.core.client.EntryPoint;
1780 aurelien 5
import com.google.gwt.core.client.GWT;
6
import com.google.gwt.user.client.Window;
10 jpm 7
 
8
public class Coel implements EntryPoint {
116 jpm 9
 
344 jp_milcent 10
	public void onModuleLoad() {
1780 aurelien 11
 
12
		// A décommenter + compiler en detailed dans le cas d'une erreur
13
		// survernant uniquement sur le serveur
14
		GWT.setUncaughtExceptionHandler(null);
15
		GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
16
			@Override
17
			public void onUncaughtException(Throwable e) {
18
					Window.alert("uncaught: " + e.getMessage());
19
					String s = buildStackTrace(e, "RuntimeException:\n");
20
					Window.alert(s);
21
					e.printStackTrace();
22
			}
23
		});
24
 
1509 jpm 25
		// Fermeture du panneau de chargement de l'appli
51 jpm 26
		GXT.hideLoadingPanel("loading");
27
 
1509 jpm 28
		// Création du médiateur
29
		new Mediateur();
30
 
31
		// Si activation du mode débug
1367 cyprien 32
		if (Mediateur.DEBUG) {
33
			System.out.println("");
34
			System.out.println("-------------------------------------------------------------------");
35
			System.out.println("");
36
		}
344 jp_milcent 37
	}
1780 aurelien 38
 
39
	private String buildStackTrace(Throwable t, String log) {
40
	    if (t != null) {
41
		     log += t.getClass().toString();
42
		     log += t.getMessage();
43
		     //
44
		     StackTraceElement[] stackTrace = t.getStackTrace();
45
		     if (stackTrace != null) {
46
		    	 StringBuffer trace = new StringBuffer();
47
 
48
			     for (int i = 0; i < stackTrace.length; i++) {
49
			    	 trace.append(stackTrace[i].getClassName() + "." + stackTrace[i].getMethodName() + "("
50
			    			 + stackTrace[i].getFileName() + ":" + stackTrace[i].getLineNumber());
51
			     }
52
 
53
			     log += trace.toString();
54
		     }
55
		     //
56
		     Throwable cause = t.getCause();
57
		     if (cause != null && cause != t) {
58
		    	 log += buildStackTrace(cause, "CausedBy:\n");
59
		     }
60
	    }
61
	    return log;
62
	}
63
 
64
	public static native void  LogVersFirebug(String s) /*-{
65
		if (!!($wnd.console && $wnd.console.log)) {
66
			console.log(s);
67
		}
68
	}-*/;
344 jp_milcent 69
}