revised like and comments number icons

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@131810 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2016-09-26 15:07:44 +00:00
parent 575e1c10a4
commit 9f16c47990
9 changed files with 103 additions and 73 deletions

View File

@ -1,19 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" output="target/news-feed-2.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java"> <classpathentry kind="src" output="target/news-feed-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" output="src/main/webapp/WEB-INF/classes" path="src/main/resources"/> <classpathentry excluding="**" kind="src" output="target/news-feed-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> <classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/> <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/> <classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"> <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes> <attributes>
@ -31,5 +39,5 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/news-feed-2.0.0-SNAPSHOT/WEB-INF/classes"/> <classpathentry kind="output" path="target/news-feed-2.1.0-SNAPSHOT/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -55,5 +55,6 @@
<nature>org.eclipse.wst.common.project.facet.core.nature</nature> <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature> <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>com.google.gwt.eclipse.core.gwtNature</nature> <nature>com.google.gwt.eclipse.core.gwtNature</nature>
<nature>com.liferay.ide.core.liferayNature</nature>
</natures> </natures>
</projectDescription> </projectDescription>

View File

@ -5,7 +5,15 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/resources"/> <dependent-module archiveName="gcube-widgets-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-widgets/gcube-widgets">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="session-checker-1.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/session-checker/session-checker">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="pickitem-widget-1.2.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/pickitem-widget/pickitem-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/> <property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="news-feed"/> <property name="context-root" value="news-feed"/>
</wb-module> </wb-module>

29
pom.xml
View File

@ -98,6 +98,32 @@
<artifactId>social-networking-library</artifactId> <artifactId>social-networking-library</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>com.netflix.astyanax</groupId>
<artifactId>astyanax</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.cassandra</groupId>
<artifactId>cassandra-all</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.cassandra</groupId>
<artifactId>cassandra-thrift</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.gcube.socialnetworking</groupId> <groupId>org.gcube.socialnetworking</groupId>
<artifactId>social-util-library</artifactId> <artifactId>social-util-library</artifactId>
@ -146,7 +172,8 @@
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<!-- Please note that the elasticsearch client needs a compress-lzf version >= 1.0.2 --> <!-- Please note that the elasticsearch client needs a compress-lzf version
>= 1.0.2 -->
<dependency> <dependency>
<groupId>com.ning</groupId> <groupId>com.ning</groupId>
<artifactId>compress-lzf</artifactId> <artifactId>compress-lzf</artifactId>

View File

@ -1291,34 +1291,25 @@ public class NewsFeedPanel extends Composite {
} }
private void doShowLikes(final String feedId) { private void doShowLikes(final String feedId) {
GWT.runAsync(UserSelectionDialog.class, new RunAsyncCallback() { final UserSelectionDialog dlg = new UserSelectionDialog("People who set this as Favorite", eventBus);
dlg.center();
dlg.show();
newsService.getAllLikesByFeed(feedId, new AsyncCallback<ArrayList<Like>>() {
@Override @Override
public void onSuccess() { public void onFailure(Throwable caught) {
final UserSelectionDialog dlg = new UserSelectionDialog("People who set this as Favorite", eventBus); Window.alert("People who liked this could not be retrieved: " + caught.getMessage());
dlg.center();
dlg.show();
newsService.getAllLikesByFeed(feedId, new AsyncCallback<ArrayList<Like>>() {
@Override
public void onFailure(Throwable caught) {
Window.alert("People who liked this could not be retrieved: " + caught.getMessage());
}
@Override
public void onSuccess(ArrayList<Like> result) {
ArrayList<ItemSelectableBean> toShow = new ArrayList<ItemSelectableBean>();
for (Like like : result) {
toShow.add(new ItemSelectableBean(like.getUserid(), like.getFullName(), like.getThumbnailURL()));
}
eventBus.fireEvent(new UsersFetchedEvent(toShow));
}
});
} }
public void onFailure(Throwable reason) {
Window.alert("Could not load this component: " + reason.getMessage());
}
});
@Override
public void onSuccess(ArrayList<Like> result) {
ArrayList<ItemSelectableBean> toShow = new ArrayList<ItemSelectableBean>();
for (Like like : result) {
toShow.add(new ItemSelectableBean(like.getUserid(), like.getFullName(), like.getThumbnailURL()));
}
eventBus.fireEvent(new UsersFetchedEvent(toShow));
}
});
} }
private void doAddComment(final TweetTemplate owner, String text, HashSet<String> mentionedUsers) { private void doAddComment(final TweetTemplate owner, String text, HashSet<String> mentionedUsers) {

View File

@ -27,8 +27,10 @@ import org.gcube.portlets.user.newsfeed.client.panels.NewsFeedPanel;
import org.gcube.portlets.widgets.imagepreviewerwidget.client.EnhancedImage; import org.gcube.portlets.widgets.imagepreviewerwidget.client.EnhancedImage;
import org.gcube.portlets.widgets.imagepreviewerwidget.client.ui.Carousel; import org.gcube.portlets.widgets.imagepreviewerwidget.client.ui.Carousel;
import com.github.gwtbootstrap.client.ui.Button;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback; import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.MouseOutEvent; import com.google.gwt.event.dom.client.MouseOutEvent;
@ -64,7 +66,7 @@ public class TweetTemplate extends Composite {
public static final String loading = GWT.getModuleBaseURL() + "../images/loading-comments.gif"; public static final String loading = GWT.getModuleBaseURL() + "../images/loading-comments.gif";
private static final int MAX_SHOWTEXT_LENGTH = 256; private static final int MAX_SHOWTEXT_LENGTH = 256;
private EnhancedFeed myFeed; private EnhancedFeed myFeed;
@ -107,9 +109,9 @@ public class TweetTemplate extends Composite {
@UiField @UiField
HTMLPanel mainHTML; HTMLPanel mainHTML;
@UiField @UiField
HTML likesNo; Button likesNo;
@UiField @UiField
HTML commentsNo; Button commentsNo;
@UiField @UiField
VerticalPanel commentsPanel; VerticalPanel commentsPanel;
@UiField @UiField
@ -134,6 +136,8 @@ public class TweetTemplate extends Composite {
*/ */
public TweetTemplate(boolean displaySingle, boolean showTimelineSource, UserInfo myUserInfo, EnhancedFeed myFeed, HandlerManager eventBus) { public TweetTemplate(boolean displaySingle, boolean showTimelineSource, UserInfo myUserInfo, EnhancedFeed myFeed, HandlerManager eventBus) {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
commentsNo.getElement().getStyle().setPaddingTop(0, Unit.PX);
likesNo.getElement().getStyle().setPaddingTop(0, Unit.PX);
myInstance = this; myInstance = this;
this.myUserInfo = myUserInfo; this.myUserInfo = myUserInfo;
this.vreSource.setVisible(false); this.vreSource.setVisible(false);
@ -369,14 +373,14 @@ public class TweetTemplate extends Composite {
timeArea.setHTML(formattedTime); timeArea.setHTML(formattedTime);
String formattedTimeWithYear = DateTimeFormat.getFormat("dd MMMM yyyy h:mm a ").format(feed.getTime()); String formattedTimeWithYear = DateTimeFormat.getFormat("dd MMMM yyyy h:mm a ").format(feed.getTime());
timeArea.setTitle(formattedTimeWithYear); timeArea.setTitle(formattedTimeWithYear);
if (! feed.getCommentsNo().equals("0")) { if (! feed.getCommentsNo().equals("0")) {
commentsNo.setHTML(feed.getCommentsNo()); commentsNo.setVisible(true);
commentsNo.setStyleName("comments-number"); commentsNo.setText(feed.getCommentsNo());
commentsNo.setTitle("People commented this."); commentsNo.setTitle(feed.getCommentsNo() + " people commented this.");
} }
if (! feed.getLikesNo().equals("0")) { if (! feed.getLikesNo().equals("0")) {
likesNo.setHTML(feed.getLikesNo()); likesNo.setVisible(true);
likesNo.setStyleName("likes-number"); likesNo.setText(feed.getLikesNo());
likesNo.setTitle("Show People who have " + NewsFeedPanel.LIKED_LABEL + " this."); likesNo.setTitle("Show People who have " + NewsFeedPanel.LIKED_LABEL + " this.");
} }
totalComments = Integer.parseInt(feed.getCommentsNo()); totalComments = Integer.parseInt(feed.getCommentsNo());
@ -392,8 +396,7 @@ public class TweetTemplate extends Composite {
if (totalComments > 2 && !displaySingle) { if (totalComments > 2 && !displaySingle) {
showAllComments = getShowAllCommentsLink(totalComments); showAllComments = getShowAllCommentsLink(totalComments);
commentsPanel.add(showAllComments); commentsPanel.add(showAllComments);
commentsNo.setStyleName("show-comments-number"); commentsNo.setVisible(true);
commentsNo.setTitle("Show all Comments");
} }
for (Comment comment : myFeed.getComments()) { for (Comment comment : myFeed.getComments()) {
addComment(new SingleComment(comment, this, (comment.getUserid().equals(myUserInfo.getUsername())))); addComment(new SingleComment(comment, this, (comment.getUserid().equals(myUserInfo.getUsername()))));
@ -487,12 +490,13 @@ public class TweetTemplate extends Composite {
cur++; cur++;
if (cur == 1) { if (cur == 1) {
myFeed.getFeed().setLikesNo("1"); myFeed.getFeed().setLikesNo("1");
likesNo.setHTML("1"); likesNo.setText("1");
likesNo.setStyleName("likes-number");
likesNo.setTitle("People who have " + NewsFeedPanel.LIKED_LABEL + " this"); likesNo.setTitle("People who have " + NewsFeedPanel.LIKED_LABEL + " this");
likesNo.setVisible(true);
} else { } else {
myFeed.getFeed().setLikesNo(""+cur); myFeed.getFeed().setLikesNo(""+cur);
likesNo.setHTML(""+cur); likesNo.setText(""+cur);
likesNo.setVisible(true);
} }
eventBus.fireEvent(new AddLikeEvent(this, myFeed.getFeed().getKey())); eventBus.fireEvent(new AddLikeEvent(this, myFeed.getFeed().getKey()));
setFavoritedUI(true); setFavoritedUI(true);
@ -506,12 +510,13 @@ public class TweetTemplate extends Composite {
cur--; cur--;
if (cur == 0) { if (cur == 0) {
myFeed.getFeed().setLikesNo("0"); myFeed.getFeed().setLikesNo("0");
likesNo.setHTML(""); likesNo.setText("");
likesNo.removeStyleName("likes-number"); likesNo.setVisible(false);
likesNo.setTitle(""); likesNo.setTitle("");
} else { } else {
myFeed.getFeed().setLikesNo(""+cur); myFeed.getFeed().setLikesNo(""+cur);
likesNo.setHTML(""+cur); likesNo.setText(""+cur);
likesNo.setVisible(true);
} }
eventBus.fireEvent(new UnLikeEvent(this, myFeed.getFeed().getKey())); eventBus.fireEvent(new UnLikeEvent(this, myFeed.getFeed().getKey()));
setFavoritedUI(false); setFavoritedUI(false);
@ -585,10 +590,11 @@ public class TweetTemplate extends Composite {
void onSeeLikes(ClickEvent e) { void onSeeLikes(ClickEvent e) {
eventBus.fireEvent(new SeeLikesEvent(myFeed.getFeed().getKey())); eventBus.fireEvent(new SeeLikesEvent(myFeed.getFeed().getKey()));
} }
@UiHandler("commentsNo") @UiHandler("commentsNo")
void onSeeComments(ClickEvent e) { void onSeeComments(ClickEvent e) {
fireSeeComments(false); fireSeeComments(false);
} }
public void setcontentAreaStyle(String cssclass) { public void setcontentAreaStyle(String cssclass) {
contentArea.getElement().getParentElement().getParentElement().setClassName("div-table-col content visible"); contentArea.getElement().getParentElement().getParentElement().setClassName("div-table-col content visible");
@ -662,10 +668,11 @@ public class TweetTemplate extends Composite {
} }
public void updateCommentsNumberCount() { public void updateCommentsNumberCount() {
if (myComments.size() == 1) { if (myComments.size() == 1) {
commentsNo.setStyleName("comments-number"); //commentsNo.setStyleName("show-comments-number");
commentsNo.setTitle("Persons who have commented this."); commentsNo.setTitle("Persons who have commented this.");
} }
commentsNo.setHTML(""+myComments.size()); //commentsNo.setHTML(commentIcon.getElement().toString()+"<span>&nbsp;</span>"+myComments.size());
commentsNo.setText(""+myComments.size());
} }
public UserInfo getMyUserInfo() { public UserInfo getMyUserInfo() {
return myUserInfo; return myUserInfo;
@ -709,7 +716,7 @@ public class TweetTemplate extends Composite {
try{ try{
ret = Integer.parseInt(likesNo.getHTML()); ret = Integer.parseInt(likesNo.getText());
}catch(NumberFormatException e){ }catch(NumberFormatException e){

View File

@ -1,6 +1,8 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:m="urn:import:org.gcube.portlets.user.newsfeed.client.ui"> xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
xmlns:m="urn:import:org.gcube.portlets.user.newsfeed.client.ui">
<g:HTMLPanel ui:field="mainHTML"> <g:HTMLPanel ui:field="mainHTML">
<div class="div-table"> <div class="div-table">
<div class="div-table-row"> <div class="div-table-row">
@ -40,11 +42,11 @@
<td align="left" style="vertical-align: top;"> <td align="left" style="vertical-align: top;">
<g:HTML styleName="time" ui:field="timeArea" /> <g:HTML styleName="time" ui:field="timeArea" />
</td> </td>
<td align="left" style="vertical-align: top; cursor:pointer;"> <td align="left" style="vertical-align: top;">
<g:HTML ui:field="commentsNo"></g:HTML> <b:Button width="45px" icon="COMMENTS" type="LINK" ui:field="commentsNo" visible="false"></b:Button>
</td> </td>
<td align="left" style="vertical-align: top;cursor:pointer;"> <td align="left" style="vertical-align: top;">
<g:HTML ui:field="likesNo"></g:HTML> <b:Button width="45px" icon="THUMBS_UP_ALT" type="LINK" ui:field="likesNo" visible="false"></b:Button>
</td> </td>
<td align="right" style="width: 100%; vertical-align: top;"> <td align="right" style="width: 100%; vertical-align: top;">
<g:HTML styleName="comment" ui:field="vreSource"></g:HTML> <g:HTML styleName="comment" ui:field="vreSource"></g:HTML>

View File

@ -91,7 +91,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
private static final String SESSION_ADMIN_ATTR = "SESSION_ADMIN_ATTR"; private static final String SESSION_ADMIN_ATTR = "SESSION_ADMIN_ATTR";
private static final String USER_SETTINGS_ATTR = "USER_SETTINGS_ATTR"; private static final String USER_SETTINGS_ATTR = "USER_SETTINGS_ATTR";
public static final String TEST_SCOPE = "/gcube/devsec/devVRE"; public static final String TEST_SCOPE = "/gcube/devNext/NextNext";
private String APP_ID; private String APP_ID;
@ -146,7 +146,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
*/ */
public String getDevelopmentUser() { public String getDevelopmentUser() {
String user = NewsConstants.TEST_USER; String user = NewsConstants.TEST_USER;
// user = "costantino.perciante"; // user = "costantino.perciante";
return user; return user;
} }
/** /**

View File

@ -442,20 +442,6 @@ a.person-link {
white-space: nowrap; white-space: nowrap;
} }
.tweet-actions .likes-number {
color: #3B5998;
width: 20px;
padding-left: 25px;
background: url("images/star_blue.png") no-repeat left;
}
.tweet-actions .comments-number, .show-comments-number {
color: #3B5998;
width: 20px;
padding-left: 25px;
background: url("images/comment_edit.png") no-repeat left;
}
.tweet-actions div { .tweet-actions div {
color: #666; color: #666;
} }