Subversion Repositories eFlore/Applications.cel

Rev

Rev 2613 | 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
 
2614 aurelien 3
import org.tela_botanica.client.i18n.Messages;
1958 aurelien 4
import org.tela_botanica.client.modeles.objets.Configuration;
5
 
6
import com.google.gwt.ajaxloader.client.AjaxLoader;
7
import com.google.gwt.ajaxloader.client.AjaxLoader.AjaxLoaderOptions;
2 aperonnet 8
import com.google.gwt.core.client.EntryPoint;
326 aurelien 9
import com.google.gwt.user.client.Timer;
10
import com.gwtext.client.core.Ext;
2 aperonnet 11
import com.gwtext.client.widgets.Viewport;
12
 
13
/**
14
 * Entry point classes define <code>onModuleLoad()</code>.
15
 */
16
public class cel2 implements EntryPoint {
17
 
7 aperonnet 18
	/**
19
	 * This is the entry point method.
20
	 */
1287 aurelien 21
	@Override
1542 aurelien 22
	public void onModuleLoad() {
12 david 23
 
2392 aurelien 24
		/*
1958 aurelien 25
		// A décommenter + compiler en detailed dans le cas d'une erreur
26
		// survernant uniquement sur le serveur
2392 aurelien 27
		GWT.setUncaughtExceptionHandler(null);
2033 aurelien 28
		GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
29
			@Override
30
			public void onUncaughtException(Throwable e) {
31
					Window.alert("uncaught: " + e.getMessage());
32
					String s = buildStackTrace(e, "RuntimeException:\n");
33
					Window.alert(s);
34
					e.printStackTrace();
1958 aurelien 35
			}
2392 aurelien 36
		});
37
		*/
2033 aurelien 38
		// TODO: config devrait être un singleton
2614 aurelien 39
		Configuration config = new Configuration();
2613 mathias 40
		Messages msg = Messages.getInstance();
41
 
2033 aurelien 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
}