Package com.google.livingstories.client

Examples of com.google.livingstories.client.Location


        if (GlobalUtil.isContentEmpty(photoUrl)) {
          savePlayer(null);
        } else {
          AssetContentItem photo = new AssetContentItem(null, new Date(), new HashSet<Long>(),
              photoUrl, Importance.MEDIUM, null, AssetType.IMAGE, name, previewPhotoUrl);
          photo.setLocation(new Location(null, null, ""));
          photo.setPublishState(PublishState.PUBLISHED);
          contentService.createOrChangeContentItem(photo, new AsyncCallback<BaseContentItem>() {
            @Override
            public void onFailure(Throwable caught) {
              problemLabel.setVisible(true);
              callbackWork.onFailure(caught);
              resetButtons();
            }

            @Override
            public void onSuccess(BaseContentItem result) {
              savePlayer((AssetContentItem)result);
            }
          });
        }
       
       
      }
     
      private void savePlayer(AssetContentItem photo) {
        List<String> aliasList = new ArrayList<String>();
        for (String alias : aliasesBox.getText().split(",")) {
          String trimmed = alias.trim();
          if (!trimmed.isEmpty()) {
            aliasList.add(trimmed);
          }
        }
       
        // Collections.emptySet() and Collections.emptyList() don't serialize properly.
        PlayerContentItem player = new PlayerContentItem(null, new Date(), new HashSet<Long>(),
            bioArea.getText(), Importance.MEDIUM, nameBox.getText(), aliasList,
            typeSelector.getSelectedConstant(), photo);
        // Kinda broken, but this isn't done automatically:
        player.setLocation(new Location(null, null, ""));
        player.setPublishState(PublishState.PUBLISHED);
        problemLabel.setVisible(false);
        contentService.createOrChangeContentItem(player, new AsyncCallback<BaseContentItem>() {
          @Override
          public void onFailure(Throwable caught) {
View Full Code Here


        }
        formatCurrentContributorList();
        contributorSuggestPanel.clear();
       
        if (mapsKeyExists) {
          Location location = selectedContentItem.getLocation();
          if (location != null) {
            Double latitude = location.getLatitude();
            latitudeTextBox.setText(latitude == null ? "" : latitude.toString());
            Double longitude = location.getLongitude();
            longitudeTextBox.setText(longitude == null ? "" : longitude.toString());
            if (latitude != null && longitude != null) {
              recenterMap();
            }  

            String description = location.getDescription();
            locationDescriptionTextArea.setText(description == null ? "" : description);
          }
          // Ensure that the state of the location controls are accurate for the content item data.
          adjustLocationControls();
          controlGeocodeButton();
View Full Code Here

          && currentContributorIdsToNamesMap.isEmpty()) {
        showInputError("Must select at least one contributor for publishing.");
        return;
      }
     
      Location location = new Location(null, null, "");
      // Initialize the location if it was entered
      if (mapsKeyExists) {
        Double latitude = null;
        Double longitude = null;
        String latitudeString = latitudeTextBox.getText();
        if (!latitudeString.isEmpty()) {
          String longitudeString = longitudeTextBox.getText();
          if (longitudeString.isEmpty()) {
            showInputError("Both latitude and longitude have to be entered.");
            return;
          }
          try {
            latitude = Double.valueOf(latitudeString);
            longitude = Double.valueOf(longitudeString);
            if (latitude > 90.0 || latitude < -90.0) {
              showInputError("Latitude should be between -90 and +90");
              return;
            }
            if (longitude > 180 || longitude < -180) {
              showInputError("Longitude should be between -180 and +180");
              return;
            }
          } catch (NumberFormatException e) {
            showInputError("Latitude and Longitude should be decimal numbers.");
            return;
          }
        }
        location = new Location(latitude, longitude, locationDescriptionTextArea.getText());
      }
     
      Set<Long> currentContributorIds = new HashSet<Long>(currentContributorIdsToNamesMap.keySet());

      BaseContentItem contentItem;
View Full Code Here

    public void setDescription(String description) {
      this.description = new LongStringHolder(description);
    }

    public Location toClientObject() {
      return new Location(latitude, longitude, description.getValue());
    }
View Full Code Here

  /**
   * Creates a location map based on the event's location.
   * @return an appropriate MapWidget, or null if no lat/lng was specified in the location.
   */
  private LocationView createMap() {
    Location location = contentItem.getLocation();

    if (location.getLatitude() == null || location.getLongitude() == null) {
      return null;
    }

    assignNavLinkString(map, LspMessageHolder.consts.locationTitle());
    return new LocationView(location);
View Full Code Here

TOP

Related Classes of com.google.livingstories.client.Location

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.