diff --git a/.classpath b/.classpath index 2f0f295..9dd4578 100644 --- a/.classpath +++ b/.classpath @@ -1,12 +1,12 @@ - + - + @@ -39,5 +39,5 @@ - + diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 3fad16f..18ea1db 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -5,6 +5,9 @@ + + uses + diff --git a/distro/changelog.xml b/distro/changelog.xml index b2aa0ea..b770c5c 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -1,14 +1,23 @@ - + + Ported to GWT 2.8.2 + Fix for Incident #11187 citing a people (with '@') in comments + is not working anymore + + Feature #11189: Social-Networking - citing a people (with '@') + in comments loses the focus. + Support for ticket #11139 fixes for Incident #10262: Cannot see who liked posts on VREs - of Parthenos + of Parthenos + Feature #10242: add comment taking up to 3 seconds sometime to - be delivered in the UI now shows a loader + be delivered in the UI now shows a loader + Ported to GWT 2.8.1 org.gcube.portlets.user news-feed war - 2.5.1-SNAPSHOT + 2.6.0-SNAPSHOT gCube News Feed Portlet @@ -25,7 +25,7 @@ - 2.8.1 + 2.8.2 18.0 distro 1.8 @@ -37,6 +37,7 @@ + org.gcube.distribution maven-portal-bom @@ -52,25 +53,37 @@ gwt-user ${gwtVersion} provided + + + javax.servlet + javax.servlet-api + + com.google.gwt gwt-dev ${gwtVersion} provided + + + javax.servlet + javax.servlet-api + + - - com.google.gwt - gwt-codeserver - ${gwtVersion} - provided - + com.google.gwt gwt-servlet ${gwtVersion} provided + + xerces + xercesImpl + 2.9.1 + xml-apis xml-apis @@ -105,9 +118,30 @@ aslsocial provided + + org.gcube.resources.discovery + ic-client + provided + + + org.gcube.common + authorization-client + provided + + + com.google + gwt-jsonmaker + + + + org.gcube.common + common-authorization + provided + org.gcube.portal social-networking-library + [1.16.0-SNAPSHOT, 2.0.0-SNAPSHOT) provided @@ -187,7 +221,7 @@ org.gcube.core common-scope-maps - provided + compile com.google.guava @@ -202,18 +236,7 @@ 1.0.3 compile - - - org.gwt-jsonmaker - gwt-jsonmaker - 1.3.0 - compile - - - net.eliasbalasis - tibcopagebus4gwt - 1.2.0 - + commons-validator commons-validator @@ -223,6 +246,18 @@ commons-codec commons-codec + + javax.servlet + javax.servlet-api + 3.1.0 + provided + + + com.sun.mail + javax.mail + 1.5.2 + provided + com.liferay.portal portal-service @@ -238,16 +273,6 @@ portlet-api provided - - javax.servlet - javax.servlet-api - provided - - - org.slf4j - slf4j-log4j12 - provided - org.slf4j slf4j-api diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/client/NewsFeed.java b/src/main/java/org/gcube/portlets/user/newsfeed/client/NewsFeed.java index ed7ec63..a64db01 100644 --- a/src/main/java/org/gcube/portlets/user/newsfeed/client/NewsFeed.java +++ b/src/main/java/org/gcube/portlets/user/newsfeed/client/NewsFeed.java @@ -1,72 +1,61 @@ package org.gcube.portlets.user.newsfeed.client; -import org.gcube.portal.databook.shared.ClientFeed; -import org.gcube.portal.databook.shared.ClientFeed.ClientFeedJsonizer; -import org.gcube.portlets.user.newsfeed.client.event.PageBusEvents; +import org.gcube.portal.databook.shared.ClientPost; +import org.gcube.portal.databook.shared.JSON; import org.gcube.portlets.user.newsfeed.client.panels.NewsFeedPanel; -import org.jsonmaker.gwt.client.Jsonizer; -import org.jsonmaker.gwt.client.base.Defaults; import com.google.gwt.core.client.EntryPoint; -import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.ui.RootPanel; -import net.eliasbalasis.tibcopagebus4gwt.client.PageBusAdapter; -import net.eliasbalasis.tibcopagebus4gwt.client.PageBusAdapterException; -import net.eliasbalasis.tibcopagebus4gwt.client.PageBusEvent; -import net.eliasbalasis.tibcopagebus4gwt.client.PageBusListener; - /** - * Entry point classes define onModuleLoad(). + * + * @author Massimiliano Assante, CNR-ISTI + * + * This class uses Liferay's Client-side+Inter-Portlet-Communication for displaying post created in the Share Updates portlet + * @see https://web.liferay.com/community/wiki/-/wiki/Main/Client-side+Inter-Portlet-Communication+%28IPC%29%20using+Java+Script + * */ public class NewsFeed implements EntryPoint { private final String UNIQUE_DIV = "newsfeedDIV"; - final public static PageBusAdapter pageBusAdapter = new PageBusAdapter(); - NewsFeedPanel mainPanel; + private NewsFeedPanel mainPanel; - public void onModuleLoad() { - init(); - } - - public void init() { - - mainPanel = new NewsFeedPanel(); + private static NewsFeedPanel instance; + public static NewsFeedPanel getInstance() { + if (instance == null) { + instance = new NewsFeedPanel(); + } + return instance; + } + + public void onModuleLoad() { + injectLiferayIPCEventReceiver(); + exportReceiveEventJavascriptFunction(); + mainPanel = getInstance(); RootPanel.get(UNIQUE_DIV).add(mainPanel); - - ClientFeed notification = new ClientFeed(); - //Subscribe to message and associate subsequent receptions with custom subscriber data - try { - pageBusAdapter.PageBusSubscribe(PageBusEvents.newPostCreated, null, null, notification, (Jsonizer)GWT.create(ClientFeedJsonizer.class)); - } - catch (PageBusAdapterException e1) { - e1.printStackTrace(); - } - - pageBusAdapter.addPageBusSubscriptionCallbackListener(new PageBusListener() { - @Override - public void onPageBusSubscriptionCallback(PageBusEvent event) { - - if(event.getSubject().equals(this.getName())){ - // translate JavaScript message contents and subscriber data to their Java equivalents - try { - ClientFeed feed = (ClientFeed)event.getMessage((Jsonizer)GWT.create(ClientFeedJsonizer.class)); - mainPanel.addJustAddedFeed(feed); - - // alert the User statistics portlet to increment the number of user's posts - pageBusAdapter.PageBusPublish(PageBusEvents.postIncrement, "", Defaults.STRING_JSONIZER); - - } catch (PageBusAdapterException e) { - e.printStackTrace(); - } - } - } - @Override - public String getName() { - return PageBusEvents.newPostCreated; - } - }); } + /** + * this is a JSNI method that injects the Liferay Javascript function listening for events from ShareUpdates + */ + public static native void injectLiferayIPCEventReceiver() /*-{ + $wnd.Liferay.on('newPostCreated',function(event) { + $wnd.handleReceiveEvent(event.payload); + }); + }-*/; + /** + * this is a JSNI method mapping the Javascript function handleReceiveEvent to the Java method handleReceiveEvent + */ + public static native void exportReceiveEventJavascriptFunction()/*-{ + $wnd.handleReceiveEvent = @org.gcube.portlets.user.newsfeed.client.NewsFeed::handleReceiveEvent(*); + }-*/; + /** + * the Java method handleReceiveEvent + * @param jsonizedClientPostInstance the jsonized {@link ClientPost} sent by ShareUpdates + */ + public static void handleReceiveEvent(String jsonizedClientPostInstance) { + ClientPost cp = (ClientPost) JSON.parse(jsonizedClientPostInstance); + getInstance().addJustAddedFeed(cp); + } } diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java b/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java index 5f3d064..1dc4087 100644 --- a/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java +++ b/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java @@ -8,7 +8,8 @@ import org.gcube.common.portal.GCubePortalConstants; import org.gcube.portal.databook.client.GCubeSocialNetworking; import org.gcube.portal.databook.client.util.Encoder; import org.gcube.portal.databook.shared.Attachment; -import org.gcube.portal.databook.shared.ClientFeed; +import org.gcube.portal.databook.shared.ClientAttachment; +import org.gcube.portal.databook.shared.ClientPost; import org.gcube.portal.databook.shared.Comment; import org.gcube.portal.databook.shared.EnhancedFeed; import org.gcube.portal.databook.shared.Feed; @@ -18,7 +19,6 @@ import org.gcube.portal.databook.shared.PrivacyLevel; import org.gcube.portal.databook.shared.ShowUserStatisticAction; import org.gcube.portal.databook.shared.UserInfo; import org.gcube.portlets.user.newsfeed.client.FilterType; -import org.gcube.portlets.user.newsfeed.client.NewsFeed; import org.gcube.portlets.user.newsfeed.client.NewsService; import org.gcube.portlets.user.newsfeed.client.NewsServiceAsync; import org.gcube.portlets.user.newsfeed.client.event.AddCommentEvent; @@ -33,7 +33,6 @@ import org.gcube.portlets.user.newsfeed.client.event.EditCommentEvent; import org.gcube.portlets.user.newsfeed.client.event.EditCommentEventHandler; import org.gcube.portlets.user.newsfeed.client.event.OpenFeedEvent; import org.gcube.portlets.user.newsfeed.client.event.OpenFeedEventHandler; -import org.gcube.portlets.user.newsfeed.client.event.PageBusEvents; import org.gcube.portlets.user.newsfeed.client.event.SeeCommentsEvent; import org.gcube.portlets.user.newsfeed.client.event.SeeCommentsEventHandler; import org.gcube.portlets.user.newsfeed.client.event.SeeLikesEvent; @@ -60,7 +59,6 @@ import org.gcube.portlets.widgets.userselection.client.events.SelectedUserEvent; import org.gcube.portlets.widgets.userselection.client.events.SelectedUserEventHandler; import org.gcube.portlets.widgets.userselection.client.events.UsersFetchedEvent; import org.gcube.portlets.widgets.userselection.shared.ItemSelectableBean; -import org.jsonmaker.gwt.client.base.Defaults; import com.github.gwtbootstrap.client.ui.Row; import com.google.gwt.core.client.GWT; @@ -84,7 +82,6 @@ import com.google.gwt.user.client.ui.SimplePanel; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; -import net.eliasbalasis.tibcopagebus4gwt.client.PageBusAdapterException; /** * * @author Massimiliano Assante, ISTI-CNR @@ -762,35 +759,35 @@ public class NewsFeedPanel extends Composite { newsPanel.insert(tt, 0); //insert in the view allUpdates.add(0, feed); //insert in the model - //timer for the transition - Timer t = new Timer() { - @Override - public void run() { - tt.setcontentAreaStyle("visible"); - - // alert the user-statistics portlet to update statistics in case - // one or more feed belongs to user himself - if(tt.isUser()){ - try{ - - NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.postIncrement, "", Defaults.STRING_JSONIZER); - - int numComments = tt.numberOfComments(); - int numLikes = tt.numberOfLikes(); - - for(int i = 0; i < numComments; i++) - NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsIncrement, "", Defaults.STRING_JSONIZER); - - for(int i = 0; i < numLikes; i++) - NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.likesIncrement, "", Defaults.STRING_JSONIZER); - - }catch (PageBusAdapterException ex) { - GWT.log(ex.toString()); - } - } - } - }; - t.schedule(100); +// //timer for the transition +// Timer t = new Timer() { +// @Override +// public void run() { +// tt.setcontentAreaStyle("visible"); +// +// // alert the user-statistics portlet to update statistics in case +// // one or more feed belongs to user himself +// if(tt.isUser()){ +// try{ +// +// NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.postIncrement, "", Defaults.STRING_JSONIZER); +// +// int numComments = tt.numberOfComments(); +// int numLikes = tt.numberOfLikes(); +// +// for(int i = 0; i < numComments; i++) +// NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsIncrement, "", Defaults.STRING_JSONIZER); +// +// for(int i = 0; i < numLikes; i++) +// NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.likesIncrement, "", Defaults.STRING_JSONIZER); +// +// }catch (PageBusAdapterException ex) { +// GWT.log(ex.toString()); +// } +// } +// } +// }; +// t.schedule(100); } //after that I remove the ($updatesNo) from Window Title String currTitle = Document.get().getTitle(); @@ -804,35 +801,42 @@ public class NewsFeedPanel extends Composite { * @param thumbURL * @param description */ - public void addJustAddedFeed(ClientFeed cFeed) { + public void addJustAddedFeed(ClientPost cFeed) { // build up the feed Feed feed = new Feed( - cFeed.getKey(), + cFeed.key, FeedType.SHARE, - cFeed.getUserid(), - cFeed.getTime(), + cFeed.userid, + cFeed.time, "", - cFeed.getUri(), - cFeed.getLinkUrlThumbnail(), - cFeed.getDescription(), + cFeed.uri, + cFeed.linkUrlThumbnail, + cFeed.description, PrivacyLevel.CONNECTION, - cFeed.getFullName(), - cFeed.getEmail(), - cFeed.getThumbnailURL(), - cFeed.getLinkTitle(), - cFeed.getLinkDescription(), - cFeed.getLinkHost()); + cFeed.fullName, + cFeed.email, + cFeed.thumbnailURL, + cFeed.linkTitle, + cFeed.linkDescription, + cFeed.linkHost); // set multi-attachments property - boolean multiAttachments = cFeed.getAttachments() != null; + boolean multiAttachments = (cFeed.attachments != null) ? cFeed.attachments.length > 0 : false; feed.setMultiFileUpload(multiAttachments); //false because he could not have liked this yet and true because is the current user's EnhancedFeed toAdd = new EnhancedFeed(feed, false, true); - // be careful when converting from List<> to ArrayList<> ... - ArrayList attachments = multiAttachments ? new ArrayList(cFeed.getAttachments()) : null; + ArrayList attachments = null; + if (multiAttachments) { + attachments = new ArrayList<>(cFeed.attachments.length); + for (int i = 0; i --> - + - + + +