Package solysombra.client

Source Code of solysombra.client.SolYSombra

package solysombra.client;

import java.util.HashMap;

import solysombra.client.views.ViewBuscadorSitio;
import solysombra.client.views.ViewCategoria;
import solysombra.client.views.ViewDatePicker;
import solysombra.client.views.ViewLogo;
import solysombra.client.views.ViewSelectorCiudad;
import solysombra.client.views.ViewSoleamiento;
import solysombra.client.views.ViewVolver;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.maps.gwt.client.Geocoder;
import com.google.maps.gwt.client.LatLng;

/**
* Entry point classes define <code>onModuleLoad()</code>.
*/


public class SolYSombra implements EntryPoint {
 
  private static HorizontalPanel viewBuscadorSitio = new HorizontalPanel();
  private static HorizontalPanel viewCategoria = new HorizontalPanel();
  private static HorizontalPanel viewClima = new HorizontalPanel();
  private static HorizontalPanel viewDatePicker = new HorizontalPanel();
  private static HorizontalPanel viewHistorial = new HorizontalPanel();
  private static HorizontalPanel viewLogo = new HorizontalPanel();
  private static HorizontalPanel viewNuevoDestino = new HorizontalPanel();
  private static HorizontalPanel viewRuta = new HorizontalPanel();
  private static HorizontalPanel viewSelectorCiudad = new HorizontalPanel();
  private static HorizontalPanel viewSoleamiento = new HorizontalPanel();
  private static HorizontalPanel viewVolver = new HorizontalPanel();
 
 
 

  private static Geocoder geocoder = Geocoder.create();
  public static LatLng myLatLng;
  public static String addr = "Pisa";

  /**
   * The message displayed to the user when the server cannot be reached or
   * returns an error.
   */
  /**
   * This is the entry point method.
   */
  public void onModuleLoad() {
    go("init", new HashMap<String, Integer>());
  }

  public static void go(String token, HashMap<String, Integer> params) {
    Panel p = RootPanel.get();
    if (token == "init") {
      p.clear();
     
      //inicializamos las vistas vacias
      viewBuscadorSitio.clear();
      viewCategoria.clear();
      viewClima.clear();
      viewDatePicker.clear();
      viewHistorial.clear();
      viewLogo.clear();
      viewNuevoDestino.clear();
      viewRuta.clear();
      viewSelectorCiudad.clear();
      viewSoleamiento.clear();
      viewVolver.clear();
     
      //a�adimos las vistas al main panel
      p.add(viewBuscadorSitio);
      p.add(viewCategoria);
      p.add(viewClima);
      p.add(viewDatePicker);
      p.add(viewHistorial);
      p.add(viewLogo);
      p.add(viewNuevoDestino);
      p.add(viewRuta);
      p.add(viewSelectorCiudad);
      p.add(viewSoleamiento);
      p.add(viewVolver);
     
      //agregamos el contenido
      viewBuscadorSitio.add(new ViewBuscadorSitio(params));
      viewLogo.add(new ViewLogo(params));
      viewSelectorCiudad.add(new ViewSelectorCiudad(params));
      viewDatePicker.add(new ViewDatePicker(params));
      viewCategoria.add(new ViewCategoria(params));
      viewSoleamiento.add(new ViewSoleamiento(params));
     
   
     
      addr = ViewBuscadorSitio.ciudades
          .getValue(ViewBuscadorSitio.ciudades.getSelectedIndex());
      // p.add(new ViewMap(params));
    } else if (token == "principal") {
      viewVolver.clear();
      // p.getElement().getChild(params.get("historial")).removeFromParent();
      // p.getElement().getChild(params.get("nuevoDestino")).removeFromParent();
      viewBuscadorSitio.add(new ViewBuscadorSitio(params));
    } else if (token == "rutaSolar") {
      viewBuscadorSitio.clear();
      // p.add(new ViewNuevoDestino(params)); TODO version final
      // params.put("nuevoDestino",p.getElement().getChildCount()-1); TODO
      // version final
      // p.add(new ViewHistorial(params));
      // params.put("historial", p.getElement().getChildCount()-1);
      viewVolver.add(new ViewVolver(params));

    } else if (token == "eligeCiudad") {
      viewBuscadorSitio.clear();
      viewBuscadorSitio.add(new ViewBuscadorSitio(params));
      // inicializaCoord();
      // showMap();
    }/*else if (token=="actualizaCategoria"){
      viewCategoria.clear();
      viewCategoria.add(new ViewCategoria(params));
    }*/

  }

  // private static void showMap() {
  // CustomizedMap1.showMap(myLatLng);
  //
  // }
  //
  // private static void inicializaCoord() {
  // GeocoderRequest GReq = GeocoderRequest.create();
  // GReq.setAddress(ViewBuscadorSitio.ciudades
  // .getValue(ViewBuscadorSitio.ciudades.getSelectedIndex())
  // .toUpperCase().trim());
  // geocoder.geocode(GReq, new Geocoder.Callback() {
  //
  // @Override
  // public void handle(JsArray<GeocoderResult> a, GeocoderStatus b) {
  // // TODO Auto-generated method stub
  //
  // if (b == GeocoderStatus.OK) {
  // GeocoderResult result = a.shift();
  // myLatLng = result.getGeometry().getLocation();
  // } else {
  // Window.alert("Algo sali� mal, comprobar la direcci�n");
  // }
  // }
  // });
  //
  // }

}
TOP

Related Classes of solysombra.client.SolYSombra

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.