Subversion Repositories eFlore/Applications.cel

Rev

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

Rev Author Line No. Line
2 aperonnet 1
package org.tela_botanica.client;
2
 
1958 aurelien 3
import org.tela_botanica.client.modeles.objets.Configuration;
4
 
5
import com.google.gwt.ajaxloader.client.AjaxLoader;
6
import com.google.gwt.ajaxloader.client.AjaxLoader.AjaxLoaderOptions;
2 aperonnet 7
import com.google.gwt.core.client.EntryPoint;
2392 aurelien 8
import com.google.gwt.core.client.GWT;
326 aurelien 9
import com.google.gwt.user.client.Timer;
2392 aurelien 10
import com.google.gwt.user.client.Window;
326 aurelien 11
import com.gwtext.client.core.Ext;
2 aperonnet 12
import com.gwtext.client.widgets.Viewport;
13
 
14
/**
15
 * Entry point classes define <code>onModuleLoad()</code>.
16
 */
17
public class cel2 implements EntryPoint {
18
 
7 aperonnet 19
	/**
20
	 * This is the entry point method.
21
	 */
1287 aurelien 22
	@Override
1542 aurelien 23
	public void onModuleLoad() {
12 david 24
 
2392 aurelien 25
		/*
1958 aurelien 26
		// A décommenter + compiler en detailed dans le cas d'une erreur
27
		// survernant uniquement sur le serveur
2392 aurelien 28
		GWT.setUncaughtExceptionHandler(null);
2033 aurelien 29
		GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
30
			@Override
31
			public void onUncaughtException(Throwable e) {
32
					Window.alert("uncaught: " + e.getMessage());
33
					String s = buildStackTrace(e, "RuntimeException:\n");
34
					Window.alert(s);
35
					e.printStackTrace();
1958 aurelien 36
			}
2392 aurelien 37
		});
38
		*/
2033 aurelien 39
		// TODO: config devrait être un singleton
1958 aurelien 40
		Configuration config = new Configuration();
2033 aurelien 41
 
42
		// Chargement de l'api google maps v3 avant l'initialisation pour
43
		// éviter des "complications"
44
		// TODO: fabriquer une classe qui cherche dans la config une liste d'api
45
		// à charger, les instancie et ensuite lance l'application
1958 aurelien 46
		AjaxLoaderOptions optAj = AjaxLoaderOptions.newInstance();
47
		optAj.setOtherParms("key="+Configuration.getCleGoogleMaps()+"&sensor=false");
48
 
49
		Runnable callback = new Runnable() {
50
			public void run() {
51
				initialiserCel();
52
			};
53
		};
54
		AjaxLoader.loadApi("maps", "3", callback, optAj);
55
	}
56
 
57
	private void initialiserCel() {
58
		CarnetEnLigneMediateur carnetEnLigneMediateur= CarnetEnLigneMediateur.Instance();
59
		new Viewport(carnetEnLigneMediateur.getPanneauPrincipalCarnetEnLigne()) ;
1542 aurelien 60
		carnetEnLigneMediateur.getEtatUtilisateur() ;
61
 
62
		Timer t = new Timer() {
63
			@Override
64
			public void run() {
65
				 Ext.get("loading").hide();
343 aurelien 66
			}
1542 aurelien 67
		};
68
 
69
		t.schedule(3000);
7 aperonnet 70
	}
1958 aurelien 71
 
2033 aurelien 72
	/*private String buildStackTrace(Throwable t, String log) {
1958 aurelien 73
	     if (t != null) {
74
		     log += t.getClass().toString();
75
		     log += t.getMessage();
76
		     //
77
		     StackTraceElement[] stackTrace = t.getStackTrace();
78
		     if (stackTrace != null) {
79
		    	 StringBuffer trace = new StringBuffer();
80
 
81
			     for (int i = 0; i < stackTrace.length; i++) {
82
			    	 trace.append(stackTrace[i].getClassName() + "." + stackTrace[i].getMethodName() + "("
83
			    			 + stackTrace[i].getFileName() + ":" + stackTrace[i].getLineNumber());
84
			     }
85
 
86
			     log += trace.toString();
87
		     }
88
		     //
89
		     Throwable cause = t.getCause();
90
		     if (cause != null && cause != t) {
91
		    	 log += buildStackTrace(cause, "CausedBy:\n");
92
		     }
93
	     }
94
	     return log;
2392 aurelien 95
	}*/
96
 
97
	public static native void  LogVersFirebug(Object o) /*-{
98
		if (!!($wnd.console && $wnd.console.log)) {
99
			console.log(o);
100
		}
101
	}-*/;
2 aperonnet 102
}