Package org.worldbank.transport.tamt.shared

Examples of org.worldbank.transport.tamt.shared.StudyRegion


                checkboxes.clear();
                uncheckMasterCheckBox();
               
                for (int i = 0; i < studyRegionList.size(); i++) {
                final int count = i;
            final StudyRegion studyRegion = studyRegionList.get(i);
           
            // if this is the current study region, let all the widgets know
            if( studyRegion.isCurrentRegion() )
            {
              // fire a new event with the minimal info required
              StudyRegion minimal = new StudyRegion();
              minimal.setId(studyRegion.getId());
              minimal.setName(studyRegion.getName());
              minimal.setMapCenter(studyRegion.getMapCenter());
              minimal.setMapZoomLevel(studyRegion.getMapZoomLevel());
             
              hasCurrentStudyRegion = true;
             
              GWT.log("RegionListing firing CurrentStudyRegionUpdatedEvent from RegionListing");
              eventBus.fireEvent(new CurrentStudyRegionUpdatedEvent(minimal));
View Full Code Here


   
    eventBus.addHandler(CurrentStudyRegionUpdatedEvent.TYPE, new CurrentStudyRegionUpdatedEventHandler() {
     
      @Override
      public void onUpdate(CurrentStudyRegionUpdatedEvent event) {
        StudyRegion currentStudyRegion = event.studyRegion;
        GWT.log("CURRENT STUDY REGION RegionInformation handler: " + currentStudyRegion);
        if (currentStudyRegion != null){
          curentStudyRegionName.setText(currentStudyRegion.getName());;
        } else {
          curentStudyRegionName.setText("<Not Set>");
        }
      }
    })
View Full Code Here

     
      @Override
      public void onLoad(LoadCurrentStudyRegionEvent event) {
        for (Iterator iterator = studyRegionList.iterator(); iterator
            .hasNext();) {
          StudyRegion studyRegion = (StudyRegion) iterator.next();
          if( studyRegion.isCurrentRegion() )
          {
            loadRegionDetails(studyRegion);
          }
        }
      }
    });
   
    eventBus.addHandler(SentUpdatedRegionPolygonEvent.TYPE, new SentUpdatedRegionPolygonEventHandler() {
     
      @Override
      public void onSentUpdatedPolygon(SentUpdatedRegionPolygonEvent event) {
        currentPolygon = event.regionPolygon;
      }
    });
   
    eventBus.addHandler(CacheRegionMapMetaDataEvent.TYPE, new CacheRegionMapMetaDataEventHandler() {
     
      @Override
      public void onCache(CacheRegionMapMetaDataEvent event) {
        GWT.log("DUPE CacheRegionMapMetaDataEventHandler");
        GWT.log("DUPE Apply mapCenter and zoomLevel to currentStudyRegionId:" + currentStudyRegionId);
        for (Iterator<StudyRegion> iterator = studyRegionList.iterator(); iterator
            .hasNext();) {
          StudyRegion studyRegion = (StudyRegion) iterator.next();
          if( studyRegion.getId().equals(currentStudyRegionId))
          {
            LatLng center = event.center;
            int mapZoomLevel = event.zoomLevel;
           
            // convert LatLng to Vertex
            Vertex mapCenter = new Vertex();
            mapCenter.setLat(center.getLatitude());
            mapCenter.setLng(center.getLongitude());
           
            studyRegion.setMapCenter(mapCenter);
            studyRegion.setMapZoomLevel(mapZoomLevel);
           
            GWT.log("DUPE Study region now has map view:" + studyRegion);
           
            break;
          }
        }
       
        // now, it makes sense to save the study region here automatically
        // rather than forcing the user to do it
        GWT.log("DUPE call saveStudyRegion");
        saveStudyRegion();
       
      }
    });
   
    eventBus.addHandler(CancelRegionEvent.TYPE, new CancelRegionEventHandler() {

      @Override
      public void onCancelRegion(CancelRegionEvent event) {
        clearRegionEditView();
      }

    });
   
    eventBus.addHandler(TAMTResizeEvent.TYPE, new TAMTResizeEventHandler() {
     
      @Override
      public void onTAMTResize(TAMTResizeEvent event) {
        GWT.log("SIZE: RegionListing scroll panel height within: " + event.height);
       
        int h = event.height - 500; // account for other study region UI (was 392)
       
        if( h > -1 )
        {
        String height = Integer.toString(h) + "px";
        GWT.log("SIZE: RegionListing scroll panel height: " + height);
        scrollPanel.setHeight(height);
        }
       
      }
    });   
   
    eventBus.addHandler(BindPolygonToRegionEvent.TYPE,
      new BindPolygonToRegionEventHandler() {
      public void onBindPolygonToRegion(BindPolygonToRegionEvent event) {
        RegionPolygon p = event.getPolygon();
        currentPolygon = p;
        GWT.log("DUPE BindPolygonToRegionEventHandler currentPolygon="+currentPolygon);
        polygonHash.put(p.getRegionDetailsId(), p);
          String n = "";
          for (Iterator iterator = studyRegionList.iterator(); iterator
            .hasNext();) {
            StudyRegion studyRegion = (StudyRegion) iterator.next();
          if(studyRegion.getId().equals(currentPolygon.getRegionDetailsId()))
          {
            n = studyRegion.getName();
          }
        }
          vertices.setText("Current polygon in RegionListing=" + n);      
      }
    });
     
    eventBus.addHandler(EndEditRegionPolygonEvent.TYPE,
      new EndEditRegionPolygonEventHandler() {
          public void onEndEditRegionPolygon(EndEditRegionPolygonEvent event) {
           
            RegionPolygon p = event.polygon;
            currentPolygon = p;
            GWT.log("DUPE EndEditRegionPolygonEventHandler currentPolygon="+currentPolygon);
            currentStudyRegionId = p.getRegionDetailsId();
           
            polygonHash.put(p.getRegionDetailsId(), p);
           
            // create a minimal StudyRegion with mapCenter and mapZoomLevel
            // and put it into the studyRegion list. This handler is only
            // run after a new StudyRegion is drawn, so we can safely add
            // it to the study region list
            StudyRegion minimal = new StudyRegion();
            minimal.setId(currentStudyRegionId);
            minimal.setMapCenter(p.getMapCenter());
            minimal.setMapZoomLevel(p.getMapZoomLevel());
            studyRegionList.add(minimal);
           
            /*
             * Debug: is the currentStudyRegionId the same as the currentPolygon.getRegionDetailsId()?
             */
            GWT.log("DUPE currentStudyRegionId("+currentStudyRegionId+"), currentPolygon.getRegionDetailsId("+currentPolygon.getRegionDetailsId()+") ");
           
            polyline.setText(p.getRegionDetailsId());
            String n = "";
            for (Iterator iterator = studyRegionList.iterator(); iterator
              .hasNext();) {
              StudyRegion studyRegion = (StudyRegion) iterator.next();
            if(studyRegion.getId().equals(currentPolygon.getRegionDetailsId()))
            {
              n = studyRegion.getName();
            }
          }
            vertices.setText("Current polygon in RegionListing=" + n);
           
            String regionName = Window.prompt("Name this region", "");
            if( regionName == null)
            {
              eventBus.fireEvent(new CancelRegionEvent(p.getRegionDetailsId()));
            } else {
              name.setText(regionName);
              description.setText("");
              description.setFocus(true);
            }
            GWT.log("DUPE id("+currentPolygon.getRegionDetailsId()+"), name("+regionName+")");
          }
    });
   
    eventBus.addHandler(GetRegionsEvent.TYPE, new GetRegionsEventHandler() {
      public void onGetRegions(GetRegionsEvent event) {
          clearRegionEditView();
          refreshStudyRegions = true;
          fetchStudyRegions();
      }
    })
   
    eventBus.addHandler(EditRegionDetailsBySegmentEvent.TYPE,
      new EditRegionDetailsBySegmentEventHandler() {
        @Override
        public void onEditRegionDetailsBySegment(EditRegionDetailsBySegmentEvent event) {
          currentPolygon = event.regionPolygon;
          GWT.log("DUPE EditRegionDetailsBySegmentEventHandler currentPolygon=" + currentPolygon);
          if( currentPolygon == null )
          {
            clearRegionEditView();
            return;
          }
          // find the roadDetails with this id in
          for (Iterator iterator = studyRegionList.iterator(); iterator
              .hasNext();) {
            StudyRegion studyRegion = (StudyRegion) iterator.next();
            //GWT.log("EDIT road details loop, working on id=" + roadDetails.getId());
            if( studyRegion.getId().equals(currentPolygon.getRegionDetailsId()))
            {
              loadRegionDetails(studyRegion);
              break;
            }
          }
View Full Code Here

      {
        Window.alert("Only one region can be copied at a time");
      } else
      {
        //Window.alert("Copy the region..." + regionIdToBeCopied + " to " + regionName);
        StudyRegion toCopy = new StudyRegion();
        toCopy.setId(regionIdToBeCopied);
        toCopy.setName(regionName);
        regionService.copyStudyRegion(toCopy, new AsyncCallback<Void>() {

          @Override
          public void onFailure(Throwable caught) {
            Window.alert("Copy study region failed: " + caught);
View Full Code Here

    if( !currentStudyRegionId.equalsIgnoreCase( currentPolygon.getRegionDetailsId() ))
    {
      GWT.log("DUPE WARNING **** currentPolygon and currentStudyRegionId are NOT synchronized!");
    }
   
    StudyRegion studyRegion = new StudyRegion();
    studyRegion.setName(name.getText());
    studyRegion.setDescription(description.getText());
    studyRegion.setId(currentStudyRegionId);
    studyRegion.setCurrentRegion(currentStudyRegionCheckBox.getValue());
    studyRegion.setDefaultZoneType(zoneTypes.getValue(zoneTypes.getSelectedIndex()));
    studyRegion.setUtcOffset(utcOffset.getValue());
    studyRegion.setCommercialZoneBlockLength(commercialZoneBlockLength.getText());
    studyRegion.setIndustrialZoneBlockLength(industrialZoneBlockLength.getText());
    studyRegion.setResidentialZoneBlockLength(residentialZoneBlockLength.getText());
    studyRegion.setMinimumSoakInterval(minimumSoakInterval.getText());
    studyRegion.setGpsTaggingTolerance(gpsTaggingTolerance.getText());
    GWT.log("DUPE Saving study region with id:" + currentStudyRegionId);
   
    /*
     * We updated the study region in the list with map data, so,
     * fetch it out of there
     */
    for (Iterator iterator = studyRegionList.iterator(); iterator
        .hasNext();) {
      StudyRegion sr = (StudyRegion) iterator.next();
      if( sr.getId().equals(currentStudyRegionId))
      {
        // transfer mapCenter and mapZoomLevel
        studyRegion.setMapCenter(sr.getMapCenter());
        studyRegion.setMapZoomLevel(sr.getMapZoomLevel());
        GWT.log("DUPE Study region now has map view:" + studyRegion);
       
        break;
      }
    }
View Full Code Here

    // if the region is null, return the traces for the current study region
    if ( region == null )
    {
      ArrayList<StudyRegion> regions = regionDAO.getStudyRegions();
      for (Iterator iterator = regions.iterator(); iterator.hasNext();) {
        StudyRegion studyRegion = (StudyRegion) iterator.next();
        if(studyRegion.isCurrentRegion())
        {
          region = studyRegion;
          break;
        }
      }
View Full Code Here

   
    // validate region
    if( trafficCountRecord.getRegion().equals(""))
    {
      ArrayList<StudyRegion> regions = regionDAO.getStudyRegions();
      StudyRegion region = null;
      for (Iterator iterator = regions.iterator(); iterator.hasNext();) {
        StudyRegion studyRegion = (StudyRegion) iterator.next();
        if(studyRegion.isCurrentRegion())
        {
          region = studyRegion;
          break;
        }
      }
View Full Code Here

    // if the region is null, return the traces for the current study region
    if ( region == null )
    {
      ArrayList<StudyRegion> regions = regionDAO.getStudyRegions();
      for (Iterator iterator = regions.iterator(); iterator.hasNext();) {
        StudyRegion studyRegion = (StudyRegion) iterator.next();
        if(studyRegion.isCurrentRegion())
        {
          region = studyRegion;
          break;
        }
      }
View Full Code Here

    ArrayList<RoadDetails> roadDetails = new ArrayList<RoadDetails>();
    if ( region == null )
    {
      ArrayList<StudyRegion> regions = regionDAO.getStudyRegions();
      for (Iterator iterator = regions.iterator(); iterator.hasNext();) {
        StudyRegion studyRegion = (StudyRegion) iterator.next();
        if(studyRegion.isCurrentRegion())
        {
          region = studyRegion;
          break;
        }
      }
View Full Code Here

    // we will need tagDetails later, so keep track of it
    currentTagDetails = tagDetails;
   
    DefaultFlow query = new DefaultFlow();
     
    StudyRegion region = new StudyRegion();
    region.setId(currentStudyRegion.getId());
    tagDetails.setRegion(region);
    query.setTagDetails(tagDetails);
   
    regionService.getDefaultFlow(query, new AsyncCallback<DefaultFlow>() {
View Full Code Here

TOP

Related Classes of org.worldbank.transport.tamt.shared.StudyRegion

Copyright © 2018 www.massapicom. 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.