Examples of DownloadFinishedListener


Examples of org.earth3d.jearth.model.events.DownloadFinishedListener

  protected int downloadedAddresses;
  protected int downloadedServices;
 
  public void testServerList() throws Exception {
    sl = new ServerList();
    sl.addListener(new DownloadFinishedListener() {
   
      public void downloadFinished(DownloadFinishedData dfd) {
        List<URL> addresses = sl.getAddresses();
        for (URL addr : addresses) {
          System.out.println("Found: "+addr);
          downloadedAddresses++;
        }
       
        synchronized(sl) {
          sl.notifyAll();
        }
      }
   
      public void downloadFailed(DownloadFinishedData dfd, Exception e) {
        InfoWindow.showError(e);

        synchronized(sl) {
          sl.notifyAll();
        }
      }
    });
    sl.download(new URL("http://www.earth3d.org/earth3daddresses.xml"));

    synchronized(sl) {
      sl.wait();
    }
   
    assertTrue(downloadedAddresses>0);
   
    // now download a service list
    serviceList = new ServiceList();
    serviceList.addListener(new DownloadFinishedListener() {
     
      public void downloadFinished(DownloadFinishedData dfd) {
        List<Service> services = serviceList.getServices();
        for (Service s : services) {
          System.out.println("Found: "+s.getConnectionList().getConnections().get(0));
          downloadedServices++;
        }
       
        synchronized(sl) {
          sl.notifyAll();
        }
      }
   
      public void downloadFailed(DownloadFinishedData dfd, Exception e) {
        InfoWindow.showError(e);

        synchronized(sl) {
          sl.notifyAll();
        }
      }
    });
    serviceList.download(sl.getAddresses().get(0));

    synchronized(sl) {
      sl.wait();
    }

    assertTrue(downloadedServices>0);

    // now choose the first service for download
    Service service = serviceList.getServices().get(0);
    service.addListener(new DownloadFinishedListener() {
     
      public void downloadFinished(DownloadFinishedData dfd) {
        synchronized(sl) {
          sl.notifyAll();
        }
      }
   
      public void downloadFailed(DownloadFinishedData dfd, Exception e) {
        InfoWindow.showError(e);

        synchronized(sl) {
          sl.notifyAll();
        }
      }
    });
    service.download();

    synchronized(sl) {
      sl.wait();
    }

    assertTrue(service.getGeometry() != null);
    assertEquals("sphere", ((GeometryMapTree) service.getGeometry()).getBase());
   
    // then download the first texture map tile and heightfield map tile
    GeometryMapTree geometry = (GeometryMapTree) service.getGeometry();
    geometry.addListener(new DownloadFinishedListener() {
     
      public void downloadFinished(DownloadFinishedData dfd) {
        synchronized(sl) {
          sl.notifyAll();
        }
View Full Code Here

Examples of org.earth3d.jearth.model.events.DownloadFinishedListener

   * @throws MalformedURLException
   * @return ServerList
   */
  public ServerList loadServerList(String url) throws MalformedURLException {
    final ServerList sl = new ServerList();
    sl.addListener(new DownloadFinishedListener() {
   
      public void downloadFinished(DownloadFinishedData dfd) {
        List<URL> addresses = sl.getAddresses();
        for (URL addr : addresses) {
          System.out.println("Found: "+addr);
View Full Code Here

Examples of org.earth3d.jearth.model.events.DownloadFinishedListener

   * @return ServiceList
   */
  public ServiceList loadServiceList(URL url) {
    // now download a service list
    final ServiceList serviceList = new ServiceList();
    serviceList.addListener(new DownloadFinishedListener() {
     
      public void downloadFinished(DownloadFinishedData dfd) {
        List<Service> services = serviceList.getServices();
        for (Service s : services) {
          System.out.println("Found: "+s.getConnectionList().getConnections().get(0));
View Full Code Here

Examples of org.earth3d.jearth.model.events.DownloadFinishedListener

   * @param service
   * @return
   */
  public Service loadService(final Service service) {
    // now choose the first service for download
    service.addListener(new DownloadFinishedListener() {
     
      public void downloadFinished(DownloadFinishedData dfd) {
        synchronized(service) {
          service.notifyAll();
        }
View Full Code Here

Examples of org.earth3d.jearth.model.events.DownloadFinishedListener

   * @see #setCurrentGeometry(Geometry)
   * @return
   */
  public Geometry loadGeometry(final Geometry geometry) {
    // then download the first geometry (e.g. the sphere)
    geometry.addListener(new DownloadFinishedListener() {
     
      public void downloadFinished(DownloadFinishedData dfd) {
        synchronized(geometry) {
          geometry.notifyAll();
        }
View Full Code Here
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.