Package org.onebusaway.transit_data.model.oba

Examples of org.onebusaway.transit_data.model.oba.LocalSearchResult


      LatLngBounds bounds = LatLngBounds.newInstance();

      for (TimedLocalSearchResult tlsr : entries) {

        LocalSearchResult entry = tlsr.getLocalSearchResult();

        int tableRow = index + 1;
        EntryClickHandler handler = new EntryClickHandler(tlsr);

        String labelPre = index < ROW_LABELS.length() ? (ROW_LABELS.charAt(index) + "") : "";
        grid.setWidget(tableRow, 0, new SpanWidget(labelPre));
        grid.getCellFormatter().addStyleName(tableRow, 0, "ResultsTableWidget-ResultsTable-LabelColumn");

        Anchor name = new Anchor(entry.getName());
        name.addClickHandler(handler);
        grid.setWidget(tableRow, 1, name);
        grid.getCellFormatter().addStyleName(tableRow, 1, "ResultsTableWidget-ResultsTable-NameColumn");

        if (entry.getRatingUrlSmall() != null) {
          Image image = new Image(entry.getRatingUrlSmall());
          grid.setWidget(tableRow, 2, image);
        } else {
          String rating = entry.getRating() + "/" + entry.getMaxRating();
          grid.setText(tableRow, 2, rating);
        }
        grid.getCellFormatter().addStyleName(tableRow, 2, "ResultsTableWidget-ResultsTable-RatingColumn");

        int minutes = tlsr.getTime() / 60;
View Full Code Here


      List<TimedLocalSearchResult> results = new ArrayList<TimedLocalSearchResult>(
          beans.size());

      for (final TimedPlaceBean bean : beans) {
        final LocalSearchResult result = _placeResults.get(bean.getPlaceId());
        TimedLocalSearchResult r = new TimedLocalSearchResult(_resultId,
            result, bean);
        results.add(r);
      }
View Full Code Here

        if (businesses == null)
          throw new YelpException("invalid businesses field in response");
        List<LocalSearchResult> results = new ArrayList<LocalSearchResult>(
            businesses.size());
        for (int i = 0; i < businesses.size(); i++) {
          LocalSearchResult result = parseResult(businesses.get(i));
          if (result != null)
            results.add(result);
        }
        _handler.onSuccess(results);
      } catch (YelpException ex) {
View Full Code Here

      String ratingUrl = JsonLibrary.getJsonString(obj, "rating_img_url");
      String ratingUrlSmall = JsonLibrary.getJsonString(obj,
          "rating_img_url_small");

      LocalSearchResult result = new LocalSearchResult();
      result.setId(id);
      result.setName(name);
      result.setUrl(url);
      result.setLat(lat);
      result.setLon(lon);
      result.setRating(rating);
      result.setMaxRating(5.0);
      result.setAddress(address);
      result.setCity(city);
      result.setRegion(region);
      result.setZip(zip);
      result.setPhoneNumber(phone);
      result.setRatingUrl(ratingUrl);
      result.setRatingUrlSmall(ratingUrlSmall);

      JSONArray categories = JsonLibrary.getJsonArray(obj, "categories");
      for (int i = 0; i < categories.size(); i++) {
        JSONValue cValue = categories.get(i);
        JSONObject cObject = cValue.isObject();
        String cName = JsonLibrary.getJsonString(cObject, "name");
        result.getCategories().add(cName);
      }

      return result;
    }
View Full Code Here

  }

  private static class SortByName implements Comparator<TimedLocalSearchResult> {

    public int compare(TimedLocalSearchResult o1, TimedLocalSearchResult o2) {
      LocalSearchResult lsr1 = o1.getLocalSearchResult();
      LocalSearchResult lsr2 = o2.getLocalSearchResult();
      return lsr1.getName().compareTo(lsr2.getName());
    }
View Full Code Here

  private static class SortByRating implements
      Comparator<TimedLocalSearchResult> {

    public int compare(TimedLocalSearchResult o1, TimedLocalSearchResult o2) {
      LocalSearchResult lsr1 = o1.getLocalSearchResult();
      LocalSearchResult lsr2 = o2.getLocalSearchResult();
      double r1 = lsr1.getRating();
      double r2 = lsr2.getRating();
      return r1 == r2 ? 0 : (r1 < r2 ? 1 : -1);
    }
View Full Code Here

      TimedLocalSearchResult result = placeChange.getSelectedResult();

      if (result != null) {

        LocalSearchResult entry = result.getLocalSearchResult();
        LatLng point = LatLng.newInstance(entry.getLat(), entry.getLon());

        updatWidgetForResult(result);
        openInfoWindowForResult(result);

        Marker m15 = new Marker(point,
View Full Code Here

  private void openInfoWindowForResult(TimedLocalSearchResult result) {

    FlowPanel panel = new FlowPanel();
    fillEntryPanel(result, panel);

    LocalSearchResult entry = result.getLocalSearchResult();

    LatLng point = LatLng.newInstance(entry.getLat(), entry.getLon());
    MapWidget map = _mapOverlayManager.getMapWidget();
    InfoWindow window = map.getInfoWindow();
    window.open(point, new InfoWindowContent(panel));
  }
View Full Code Here

    window.open(point, new InfoWindowContent(panel));
  }

  private void fillEntryPanel(TimedLocalSearchResult result, FlowPanel panel) {

    LocalSearchResult entry = result.getLocalSearchResult();

    DivPanel namePanel = new DivPanel();
    namePanel.addStyleName(_css.ActiveResultNamePanel());
    panel.add(namePanel);

    if (entry.getUrl() == null) {
      DivWidget name = new DivWidget(entry.getName());
      name.addStyleName(_css.ActiveResultName());
      namePanel.add(name);
    } else {
      Anchor name = new Anchor(entry.getName(), entry.getUrl());
      name.addStyleName(_css.ActiveResultName());
      name.setTarget("_blank");
      namePanel.add(name);
    }

    DivWidget address = new DivWidget(getFormatedAddressForEntry(entry));
    address.addStyleName(_css.ActiveResultAddress());
    panel.add(address);

    DivWidget phone = new DivWidget(getFormatedPhoneNumber(entry));
    phone.addStyleName(_css.ActiveResultPhone());
    panel.add(phone);

    DivPanel ratingPanel = new DivPanel();
    ratingPanel.addStyleName(_css.ActiveResultRatingPanel());
    panel.add(ratingPanel);

    if (entry.getRatingUrl() != null) {
      Image image = new Image(entry.getRatingUrl());
      image.setSize("84px", "17px");
      image.addStyleName(_css.ActiveResultRatingImage());
      ratingPanel.add(image);
    } else if (entry.getRatingUrlSmall() != null) {
      Image image = new Image(entry.getRatingUrlSmall());
      image.addStyleName(_css.ActiveResultRatingImageSmall());
      ratingPanel.add(image);
    } else {
      DivWidget rating = new DivWidget(entry.getRating() + "/"
          + entry.getMaxRating());
      ratingPanel.add(rating);
    }

    DivWidget time = new DivWidget("Travel time: ~" + (result.getTime() / 60)
        + " mins");
View Full Code Here

      List<TimedLocalSearchResult> results = model.getResults();

      Map<String, Integer> counts = new HashMap<String, Integer>();
      for (TimedLocalSearchResult result : results) {
        LocalSearchResult r = result.getLocalSearchResult();
        for (String category : r.getCategories()) {
          Integer count = counts.get(category);
          if (count == null)
            count = 0;
          counts.put(category, count + 1);
        }
View Full Code Here

TOP

Related Classes of org.onebusaway.transit_data.model.oba.LocalSearchResult

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.