コード例 #1
0
 private void setDataTabs(LocationAwareTask item) {
   if (item.getOffers() != null) {
     int offersNumber = item.getOffers().size();
     if (offersNumber > 0) {
       tabOffers.setTabItemSizeText(String.valueOf(offersNumber));
     }
   }
   if (item.getNearby() != null) {
     int placesNumber = item.getNearby().size();
     if (placesNumber > 0) {
       tabPlaces.setTabItemSizeText(String.valueOf(placesNumber));
     }
   }
   if (item.getMessageThreads() != null) {
     int messagesNumber = item.getMessageThreads().size();
     if (messagesNumber > 0) {
       tabFriends.setTabItemSizeText(String.valueOf(messagesNumber));
     }
   }
 }
コード例 #2
0
  @Override
  public void setData(LocationAwareTask item, LocationAwareFriendInfo friendInfo, String username) {
    // Image Title
    if (item.getType() == LocationAwareTask.CONSTANT_TASK_ITEM_TYPE_INTERESTS) {
      itemTitlePanel.setImageTitleForItemInterest(true);
    } else {
      itemTitlePanel.setImageTitleForItemInterest(false);
    }

    // Data Tabs
    setDataTabs(item);

    // Social Connections
    boolean itLikesYou = item.youLikeIt(username);
    boolean youWantIt = item.youWantIt(username);
    int likesCount = item.getLikesCount();
    int wantsCount = item.getWantsCount();
    itemTitlePanel.setLikesConnections(likesCount, itLikesYou);
    itemTitlePanel.setWantsConnections(wantsCount, youWantIt);
    if (friendInfo != null) {
      itemTitlePanel.setAvatar(friendInfo.getUrlProfilePicture());
      itemTitlePanel.setDescription(
          MESSAGES.for_friend(item.getDescription(), friendInfo.getFirstName()));
    } else {
      itemTitlePanel.setDescription(StringUtils.getLocationAwareTaskDescription(item));
    }
    if (likesCount == 0 && wantsCount == 0) {
      itemTitlePanel.hideSocialBar();
    }

    // Places
    if (item.getNearby() != null && item.getNearby().size() > 0) {
      setPlaces(item.getNearby());
    } else {
      ItemDetailEmptyListPanel emptyItemList = new ItemDetailEmptyListPanel();
      emptyItemList.setContainerEmptyMessage(MESSAGES.empty_list_places_text());
      placesPanel.add(emptyItemList);
      emptyItemList.addStyleName("noPlaces");
    }

    // Offers
    if (item.getOffers() != null && item.getOffers().size() > 0) {
      setOffers(item.getOffers());
    } else {
      ItemDetailEmptyListPanel emptyItemList = new ItemDetailEmptyListPanel();
      emptyItemList.setContainerEmptyMessage(MESSAGES.empty_list_offers_text());
      offersPanel.add(emptyItemList);
      emptyItemList.addStyleName("noOffers");
    }

    // Friends messages
    if (item.getMessageThreads() != null && item.getMessageThreads().size() > 0) {
      setFriendsMessages(item.getMessageThreads());
    } else {
      ItemDetailEmptyListPanel emptyItemList = new ItemDetailEmptyListPanel();
      emptyItemList.setContainerEmptyMessage(MESSAGES.empty_list_friends_messages_text());
      friendsPanel.add(emptyItemList);
      emptyItemList.addStyleName("noFriends");
    }
  }