Subversion Repositories eFlore/Applications.cel

Rev

Rev 1542 | Go to most recent revision | Blame | Last modification | View Log | RSS feed

package org.tela_botanica.client;

import org.tela_botanica.client.modeles.objets.Configuration;

import com.google.gwt.ajaxloader.client.AjaxLoader;
import com.google.gwt.ajaxloader.client.AjaxLoader.AjaxLoaderOptions;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Timer;
import com.gwtext.client.core.Ext;
import com.gwtext.client.widgets.Viewport;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class cel2 implements EntryPoint {

        /**
         * This is the entry point method.
         */
        @Override
        public void onModuleLoad() {    
                
                
                // A décommenter + compiler en detailed dans le cas d'une erreur
                // survernant uniquement sur le serveur
                /*GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
                
                @Override
                public void onUncaughtException(Throwable e) {
                                Window.alert("uncaught: " + e.getMessage());
                                String s = buildStackTrace(e, "RuntimeException:\n");
                                Window.alert(s);
                                e.printStackTrace();
                        }
                });*/
                Configuration config = new Configuration();
                AjaxLoaderOptions optAj = AjaxLoaderOptions.newInstance();
                optAj.setOtherParms("key="+Configuration.getCleGoogleMaps()+"&sensor=false");
                        
                Runnable callback = new Runnable() {
                        public void run() {
                                initialiserCel();
                        };
                };
                AjaxLoader.loadApi("maps", "3", callback, optAj);
        }
        
        private void initialiserCel() {
                CarnetEnLigneMediateur carnetEnLigneMediateur= CarnetEnLigneMediateur.Instance();
                new Viewport(carnetEnLigneMediateur.getPanneauPrincipalCarnetEnLigne()) ;
                carnetEnLigneMediateur.getEtatUtilisateur() ;

                Timer t = new Timer() {
                        @Override
                        public void run() {
                                 Ext.get("loading").hide();
                        }
                };
                
                t.schedule(3000);
        }
        
        private String buildStackTrace(Throwable t, String log) {
             if (t != null) {
                     log += t.getClass().toString();
                     log += t.getMessage();
                     //
                     StackTraceElement[] stackTrace = t.getStackTrace();
                     if (stackTrace != null) {
                         StringBuffer trace = new StringBuffer();
                    
                             for (int i = 0; i < stackTrace.length; i++) {
                                 trace.append(stackTrace[i].getClassName() + "." + stackTrace[i].getMethodName() + "("
                                                 + stackTrace[i].getFileName() + ":" + stackTrace[i].getLineNumber());
                             }
                    
                             log += trace.toString();
                     }
                     //
                     Throwable cause = t.getCause();
                     if (cause != null && cause != t) {
                         log += buildStackTrace(cause, "CausedBy:\n");
                     }
             }
             return log;
          }
}