Subversion Repositories eFlore/Applications.cel

Rev

Rev 2613 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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