works like a charm
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@73682 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b55f18790e
commit
a7c3191953
|
@ -3,6 +3,7 @@ package org.gcube.portlets.user.newsfeed.client.panels;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
import org.gcube.portal.databook.client.GCubeSocialNetworking;
|
||||
import org.gcube.portal.databook.shared.ClientFeed;
|
||||
import org.gcube.portal.databook.shared.Comment;
|
||||
import org.gcube.portal.databook.shared.Feed;
|
||||
|
@ -66,7 +67,8 @@ public class NewsFeedPanel extends Composite {
|
|||
private final HandlerManager eventBus = new HandlerManager(null);
|
||||
|
||||
private VerticalPanel mainPanel = new VerticalPanel();
|
||||
private HorizontalPanel filterPanel = new HorizontalPanel();
|
||||
private HorizontalPanel filterPanelWrapper = new HorizontalPanel();
|
||||
private FilterPanel filterPanel;
|
||||
private SimplePanel newUpdatesPanel = new SimplePanel();
|
||||
private VerticalPanel newsPanel = new VerticalPanel();
|
||||
|
||||
|
@ -172,12 +174,12 @@ public class NewsFeedPanel extends Composite {
|
|||
public NewsFeedPanel() {
|
||||
bind();
|
||||
mainPanel.setWidth("600px");
|
||||
mainPanel.add(filterPanel);
|
||||
filterPanel.setVisible(false);
|
||||
mainPanel.add(filterPanelWrapper);
|
||||
filterPanelWrapper.setVisible(false);
|
||||
mainPanel.add(newUpdatesPanel);
|
||||
mainPanel.add(newsPanel);
|
||||
|
||||
filterPanel.add(new FilterPanel(this, newsService));
|
||||
filterPanel = new FilterPanel(this, newsService);
|
||||
filterPanelWrapper.add(filterPanel);
|
||||
initWidget(mainPanel);
|
||||
newsPanel.clear();
|
||||
newsPanel.setWidth("100%");
|
||||
|
@ -203,6 +205,7 @@ public class NewsFeedPanel extends Composite {
|
|||
if (getFeedToShowId() != null) {
|
||||
String feedKey = getFeedToShowId();
|
||||
showSingleFeed(feedKey);
|
||||
filterPanel.removeFilterSelected();
|
||||
} else {
|
||||
showAllUpdatesFeeds();
|
||||
}
|
||||
|
@ -210,7 +213,7 @@ public class NewsFeedPanel extends Composite {
|
|||
}
|
||||
//adjustments in the UI Depending on the scope
|
||||
if (result.isInfrastructure())
|
||||
filterPanel.setVisible(true);
|
||||
filterPanelWrapper.setVisible(true);
|
||||
else
|
||||
mainPanel.addStyleName("framed");
|
||||
|
||||
|
@ -255,10 +258,16 @@ public class NewsFeedPanel extends Composite {
|
|||
newsService.getSingleFeed(feedKey, new AsyncCallback<EnhancedFeed>() {
|
||||
@Override
|
||||
public void onSuccess(EnhancedFeed result) {
|
||||
if (result.getFeed().getType() == FeedType.DISABLED) {
|
||||
String usrLink = "<a class=\"link\" href=\""+GCubeSocialNetworking.USER_PROFILE_LINK+"?uid="+result.getFeed().getEntityId() + "\">"+result.getFeed().getFullName() +"</a> ";
|
||||
newsPanel.add(new HTML("<div class=\"nofeed-message\"><div style=\"padding-top: 90px;\">" +
|
||||
"We're sorry, "+ usrLink +" removed the post in the meantime!</div></div>"));
|
||||
} else{
|
||||
newsPanel.setHeight("");
|
||||
newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
|
||||
newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
|
||||
newsPanel.add(new TweetTemplate(true, myUserInfo, result, eventBus));
|
||||
}
|
||||
newsPanel.add(new Image(spacer));
|
||||
}
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.gcube.portlets.user.newsfeed.client.templates;
|
||||
|
||||
import org.gcube.portal.databook.shared.UserInfo;
|
||||
import org.gcube.portlets.user.newsfeed.client.FilterType;
|
||||
import org.gcube.portlets.user.newsfeed.client.NewsServiceAsync;
|
||||
import org.gcube.portlets.user.newsfeed.client.panels.NewsFeedPanel;
|
||||
|
@ -81,6 +80,11 @@ public class FilterPanel extends Composite {
|
|||
// });
|
||||
// }
|
||||
//
|
||||
public void removeFilterSelected() {
|
||||
allUpdatesLink.removeStyleName("filter-selected");
|
||||
onlyme.removeStyleName("filter-selected");
|
||||
favoritesLink.removeStyleName("filter-selected");
|
||||
}
|
||||
|
||||
@UiHandler("favoritesLink")
|
||||
void onFavoritesClick(ClickEvent e) {
|
||||
|
|
|
@ -602,7 +602,11 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
|||
}
|
||||
|
||||
private UserSettings getUserSettingsFromSession() {
|
||||
try {
|
||||
return (UserSettings) getASLSession().getAttribute(USER_SETTINGS_ATTR);
|
||||
} catch (ClassCastException e) { //handle the hot deploy
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void setUserSettingsInSession(UserSettings user) {
|
||||
|
|
Loading…
Reference in New Issue