Package org.worldbank.transport.tamt.client.event

Examples of org.worldbank.transport.tamt.client.event.CurrentStudyRegionUpdatedEvent


             * If there are no study regions...
             */
            if( studyRegionList.size() == 0 )
            {
              GWT.log("CURRENT STUDY REGION: No study regions, set current study region to NULL");
              eventBus.fireEvent(new CurrentStudyRegionUpdatedEvent(null));
            }
           
                // create a hash of <roadId>|vertex array to throw over to RegionMap for rendering
                vertexHash = new HashMap<String, ArrayList<Vertex>>();
               
                boolean hasCurrentStudyRegion = false;
               
                // clear out the checkboxes
                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));
            }
           
           
            // stick the vertices for this regionDetails in the vertexHash
            vertexHash.put(studyRegion.getId(), studyRegion.getVertices());
           
            CheckBox cb = new CheckBox();
            cb.setFormValue(studyRegion.getId()); //store the id in the checkbox value
            checkboxes.add(cb); // keep track for selecting all|none to delete
            cb.setStyleName(style.checkbox());
           
            // if a checkbox is checked, deselect the master checkbox
            cb.addClickHandler(new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                uncheckMasterCheckBox();
              }
            });
           
            Label name = new Label(studyRegion.getName());
            name.setStyleName(style.zoneList());
            name.addStyleName(style.clickable());
            name.addClickHandler(new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                loadRegionDetails(studyRegion);
              }
            });
            regionList.setWidget(i, 0, cb);
            regionList.getCellFormatter().setWidth(i, 0, "20px");
            regionList.setWidget(i, 1, name);
           
           
                }
               
                // now tell RegionMap to pick up the vertexHash and render the shapes
                GWT.log("Fire RenderRegionsEvent");
                eventBus.fireEvent(new RenderRegionsEvent(vertexHash));
               
                /*
                 * If none of the study regions were set as current..
                 */
                if( !hasCurrentStudyRegion )
                {
                  GWT.log("CURRENT STUDY REGION: None of the study regions are set as current");
                  eventBus.fireEvent(new CurrentStudyRegionUpdatedEvent(null));
                }
               
        }
      });
     
View Full Code Here

TOP

Related Classes of org.worldbank.transport.tamt.client.event.CurrentStudyRegionUpdatedEvent

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.