Package com.google.livingstories.client

Examples of com.google.livingstories.client.BaseContentItem


    matcher.appendTail(sb);
    return sb.toString();
  }
 
  public BaseContentItem toClientObject() {
    BaseContentItem ret = toClientObjectImpl();
    ret.setPublishState(publishState);
    ret.setThemeIds(themeIds);
    ret.setLinkedContentItemIds(linkedContentEntityIds);
    ret.setLocation(location.toClientObject());
    ret.setTimeElapsedSinceLastUpdate(TimeUtil.getElapsedTimeString(this.timestamp));
   
    BaseContentItem sourceContentItem = null;
    Long sourceContentEntityId = getSourceContentEntityId();
    if (sourceContentEntityId != null) {
      try {
        sourceContentItem = new ContentRpcImpl().getContentItem(sourceContentEntityId, false);
      } catch (JDOException ex) {
View Full Code Here


        new HashMap<ContentItemType, List<BaseContentItem>>();
    for (ContentItemType type : ContentItemType.values()) {
      linkedContentItemsByType.put(type, new ArrayList<BaseContentItem>());
    }
    for (Long contentItemId : contentItem.getLinkedContentItemIds()) {
      BaseContentItem linkedContentItem = idToContentItemMap.get(contentItemId);
      if (linkedContentItem != null) {
        linkedContentItemsByType.get(linkedContentItem.getContentItemType()).add(linkedContentItem);

        if (contentItem.getRenderAsSeen() && lastVisitDate != null
            && linkedContentItem.getTimestamp().after(lastVisitDate)) {
          contentItem.setRenderAsSeen(false);
        }
      }
    }
    for (BaseContentItem narrative : linkedContentItemsByType.get(ContentItemType.NARRATIVE)) {
View Full Code Here

      public void onChange(ChangeEvent event) {
        contentPanel.showWidget(1);
        topSaveControls.statusLabel.setText("");
        bottomSaveControls.statusLabel.setText("");
       
        BaseContentItem selectedContentItem = contentItemListBox.getSelectedContentItem();
        contentItemIdLabel.setText(String.valueOf(selectedContentItem.getId()));
        contentEditor.setContent(selectedContentItem.getContent());
        timestamp.setText(DateUtil.formatDateTime(selectedContentItem.getTimestamp()));
        importanceSelector.selectConstant(selectedContentItem.getImportance());
        contentItemTypeSelector.selectConstant(selectedContentItem.getContentItemType());
        setAssetControlVisibility();
        showSpecialAttributesPanel(selectedContentItem.getContentItemType());

        // First clear or set these fields to default values.
        // Otherwise, if the user changes the content item type, they may
        // see data from some other content item in the form fields.
        startDatePicker.setValue(DateUtil.getDateMidnight());
        startTime.setText("");
        endDatePicker.setValue(DateUtil.getDateMidnight());
        endTime.setText("");
        setDateTriggerText();
        updateEditor.setText("");
        summaryEditor.setContent("");
        nameTextBox.setText("");
        aliasesTextBox.setText("");
        playerTypeSelector.selectConstant(PlayerType.PERSON);
        photoSelector.setSelection(null);
        assetTypeSelector.selectConstant(AssetType.IMAGE);
        captionTextArea.setText("");
        previewUrlTextBox.setText("");
        imageUrlTextBox.setText("");
        headlineTextBox.setText("");
        narrativeTypeSelector.selectConstant(NarrativeType.FEATURE);
        narrativeDateBox.setValue(null);
        narrativeSummaryTextArea.setContent("");
       
        parentPlayer = null;
        formatParentPlayerDisplay();

        switch (selectedContentItem.getContentItemType()) {
          case EVENT:
            EventContentItem eventContentItem = (EventContentItem) selectedContentItem;
            Date startDate = eventContentItem.getEventStartDate();
            Date endDate = eventContentItem.getEventEndDate();
            if (startDate == null) {
              startDate = new Date();
            }
            startDatePicker.setValue(startDate);
            startDatePicker.setCurrentMonth(startDatePicker.getValue());
            startTime.setValue(DateUtil.formatTime(startDate));
            hasSeparateEndDate.setValue(endDate != null, true);
            endDatePicker.setValue(endDate == null ? startDatePicker.getValue() : endDate);
            endDatePicker.setCurrentMonth(endDatePicker.getValue());
            endTime.setText(endDate == null ? startTime.getText() : DateUtil.formatTime(endDate));
            setDateTriggerText();
            updateEditor.setText(eventContentItem.getEventUpdate());
            summaryEditor.setContent(eventContentItem.getEventSummary());
            break;
          case PLAYER:
            if (selectedContentItem.getLivingStoryId() == null) {
              PlayerContentItem playerContentItem = (PlayerContentItem) selectedContentItem;
              nameTextBox.setText(playerContentItem.getName());
              aliasesTextBox.setText(GlobalUtil.join(",", playerContentItem.getAliases()));
              playerTypeSelector.selectConstant(playerContentItem.getPlayerType());
              photoSelector.setSelection(playerContentItem.getPhotoContentItem());
            } else {
              parentPlayer =
                  ((StoryPlayerContentItem) selectedContentItem).getParentPlayerContentItem();
              formatParentPlayerDisplay();
            }
            break;
          case ASSET:
            AssetContentItem assetContentItem = (AssetContentItem) selectedContentItem;
            AssetType assetType = assetContentItem.getAssetType();
            assetTypeSelector.selectConstant(assetType);
            setAssetControlVisibility();
            captionTextArea.setText(assetContentItem.getCaption());
            previewUrlTextBox.setText(assetContentItem.getPreviewUrl());
            if (assetType == AssetType.IMAGE) {
              contentEditor.setContent("");
              imageUrlTextBox.setText(selectedContentItem.getContent());
            }
            break;
          case NARRATIVE:
            NarrativeContentItem narrativeContentItem = (NarrativeContentItem) selectedContentItem;
            headlineTextBox.setText(narrativeContentItem.getHeadline());
            narrativeTypeSelector.selectConstant(narrativeContentItem.getNarrativeType());
            narrativeDateBox.setValue(narrativeContentItem.getNarrativeDate());
            narrativeSummaryTextArea.setContent(narrativeContentItem.getNarrativeSummary());
            break;
          case BACKGROUND:
            BackgroundContentItem backgroundContentItem =
                (BackgroundContentItem) selectedContentItem;
            if (backgroundContentItem.isConcept()) {
              conceptNameTextBox.setText(backgroundContentItem.getConceptName());
            }
            break;
        }
       
        int themeCount = themeListBox.getItemCount();
        Set<Long> themesInContentItem = selectedContentItem.getThemeIds();
        for (int i = 0; i < themeCount; i++) {
          themeListBox.setItemSelected(i, themesInContentItem.contains(
              Long.parseLong(themeListBox.getValue(i))));
        }
       
        currentContributorIdsToNamesMap.clear();
        for (Long contributorId : selectedContentItem.getContributorIds()) {
          currentContributorIdsToNamesMap.put(contributorId,
              unassignedPlayersIdToContentItemMap.get(contributorId).getName());
        }
        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();
        }
        // Set the source information related fields
        String sourceDescription = selectedContentItem.getSourceDescription();
        sourceDescriptionBox.setText(sourceDescription == null ? "" : sourceDescription);
        sourceContentItemSelector.setSelection(selectedContentItem.getSourceContentItem());
  
        updateSelectedLinkedContentItems(selectedContentItem);

        updateDisplayedPublishStatus(selectedContentItem);
        topSaveControls.deleteButton.setEnabled(true);
View Full Code Here

      }
    }
  }

  private void updatePreview() {
    BaseContentItem contentItem = contentItemListBox.getSelectedContentItem();
    if (contentItem.getDisplayString().equals("New Content Item")) {
      previewPanel.clear();
    } else {
      previewPanel.setWidget(StreamViewFactory.createView(contentItem,
          contentItemListBox.getLoadedContentItemsMap()));
    }
View Full Code Here

TOP

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

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.