Ported to GWT 2.8.2
Fix for Incident #11187 citing a people (with '@') in comments is not working anymore</Change> Feature #11189: Social-Networking - citing a people (with '@') in comments loses the focus. git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@164785 82a268e6-3cf1-43bd-a215-b396298e98cfFeature/26194
parent
509ee88dfc
commit
0d40b1562d
@ -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 <code>onModuleLoad()</code>.
|
||||
*
|
||||
* @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;
|
||||
|
||||
|
||||
public void onModuleLoad() {
|
||||
init();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
private NewsFeedPanel mainPanel;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,40 @@
|
||||
# gCube Portal custom log4j Logger
|
||||
#Author: Massimiliano Assante, ISTI-CNR
|
||||
|
||||
log4j.rootLogger=INFO, CA
|
||||
|
||||
log4j.appender.CA=org.apache.log4j.ConsoleAppender
|
||||
|
||||
log4j.appender.CA.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.CA.layout.ConversionPattern=[PORTAL] %-4r [%t] %-5p %c %x - %m%n
|
||||
|
||||
# Display any warnings generated by our code
|
||||
#log4j.category.org.globus=WARN
|
||||
|
||||
# Comment out the line below if you want to log every authorization
|
||||
# decision the notification consumer makes.
|
||||
#log4j.category.org.globus.wsrf.impl.security.authorization.ServiceAuthorizationChain=ERROR
|
||||
|
||||
log4j.logger.org.gcube=TRACE, GCUBE
|
||||
log4j.appender.GCUBE.threshold=DEBUG
|
||||
log4j.appender.GCUBE=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.GCUBE.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.GCUBE.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} [%t,%M:%L] %
|
||||
m%n
|
||||
|
||||
log4j.logger.org.apache.jasper.compiler.TldLocationsCache.level=ERROR, CA
|
||||
#AVOID LOGGING EHCACHE Hearbeat problem
|
||||
log4j.logger.net.sf.ehcache.distribution.PayloadUtil=OFF, CA
|
||||
|
||||
log4j.logger.org.gcube.portal.notifications=INFO, CA
|
||||
log4j.logger.org.gcube.common.scope.impl=INFO, CA
|
||||
log4j.logger.org.gcube.common.core.utils.events=INFO, CA
|
||||
log4j.logger.org.gcube.portlets.user.homelibrary=INFO CA
|
||||
log4j.logger.org.gcube.common.resources.kxml=ERROR, CA
|
||||
log4j.logger.org.gcube.application.aquamaps.enhabling.Impl.ISCrawler=ERROR, CA
|
||||
log4j.logger.com.netflix.astyanax.connectionpool.impl=ERROR, CA
|
||||
log4j.logger.org.gcube.common.scope.impl=INFO, CA
|
||||
log4j.logger.com.couchbase.client=ERROR, CA
|
||||
log4j.logger.org.gcube.smartgears.handlers=INFO, CA
|
||||
log4j.logger.org.gcube.informationsystem.publisher=INFO, CA
|
||||
log4j.logger.org.gcube.application.framework.core.session=INFO, CA
|
Loading…
Reference in New Issue