@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"); } }
public ItemDetailTouchScreenView() { // Handler Manager handlerManager = new HandlerManager(this); VerticalPanel verticalPanel = new VerticalPanel(); initWidget(verticalPanel); verticalPanel.setWidth("100%"); HeaderDeclarativeView headerView = new HeaderDeclarativeView(); headerView.setSize("100%", "100%"); verticalPanel.add(headerView); setHeaderDisplay(headerView); contentPanel = new VerticalPanel(); contentPanel.setSpacing(0); verticalPanel.add(contentPanel); contentPanel.setWidth("100%"); contentPanel.addStyleName("forFriendPanel"); itemTitlePanel = new ItemDetailTitlePanel(); contentPanel.add(itemTitlePanel); itemTitlePanel.setStyleName("itemDetail-Panel"); itemTitlePanel.setWidth("100%"); itemDetailTabPanel = new DecoratedTabPanel(); contentPanel.add(itemDetailTabPanel); itemDetailTabPanel.setSize("100%", "100%"); contentPanel.addStyleName("forFriendPanel"); offersPanel = new VerticalPanel(); tabOffers = new ItemDetailTabPanel(); tabOffers.setTabImageUrl("images/172-pricetag-disabled.png"); tabOffers.setTabDescriptionLabelText(MESSAGES.tabOffersText_text()); itemDetailTabPanel.add(offersPanel, tabOffers); offersPanel.setSize("100%", "100%"); offersPanel.setSpacing(0); placesPanel = new VerticalPanel(); tabPlaces = new ItemDetailTabPanel(); tabPlaces.setTabImageUrl("images/07-map-marker-disabled.png"); tabPlaces.setTabDescriptionLabelText(MESSAGES.tabPlacesText_text()); itemDetailTabPanel.add(placesPanel, tabPlaces); placesPanel.setSize("100%", "100%"); placesPanel.setSpacing(0); friendsPanel = new VerticalPanel(); tabFriends = new ItemDetailTabPanel(); tabFriends.setTabImageUrl("images/111-user-disabled.png"); tabFriends.setTabDescriptionLabelText(MESSAGES.tabFriendsText_text()); itemDetailTabPanel.add(friendsPanel, tabFriends); friendsPanel.setSize("100%", "100%"); friendsPanel.setSpacing(0); itemDetailTabPanel .getTabBar() .addSelectionHandler( new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { int selTab = event.getSelectedItem(); if (selTab == 0) { tabOffers.setTabImageUrl("images/172-pricetag.png"); tabPlaces.setTabImageUrl("images/07-map-marker-disabled.png"); tabFriends.setTabImageUrl("images/111-user-disabled.png"); } else if (selTab == 1) { tabPlaces.setTabImageUrl("images/07-map-marker.png"); tabOffers.setTabImageUrl("images/172-pricetag-disabled.png"); tabFriends.setTabImageUrl("images/111-user-disabled.png"); } else if (selTab == 2) { tabFriends.setTabImageUrl("images/111-user.png"); tabOffers.setTabImageUrl("images/172-pricetag-disabled.png"); tabPlaces.setTabImageUrl("images/07-map-marker-disabled.png"); } ; } }); }
@Override public boolean askCancelConfirmation() { return Window.confirm(MESSAGES.cancel_changes_message_text()); }