smart refresh implemented and tested, one corner case left
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@73068 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d8d339db27
commit
80bc8b119a
10
.classpath
10
.classpath
|
@ -20,16 +20,16 @@
|
||||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="owner.project.facets" value="java"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="output" path="target/news-feed-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/news-feed-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#Thu Apr 04 16:40:07 CEST 2013
|
#Tue Apr 09 11:48:39 CEST 2013
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -211,8 +211,8 @@
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>2.3.2</version>
|
<version>2.3.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.5</source>
|
<source>1.6</source>
|
||||||
<target>1.5</target>
|
<target>1.6</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- SA Plugin -->
|
<!-- SA Plugin -->
|
||||||
|
|
|
@ -53,6 +53,8 @@ import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
import com.google.gwt.user.client.ui.Image;
|
import com.google.gwt.user.client.ui.Image;
|
||||||
import com.google.gwt.user.client.ui.SimplePanel;
|
import com.google.gwt.user.client.ui.SimplePanel;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
|
|
||||||
|
import edu.emory.mathcs.backport.java.util.Collections;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Massimiliano Assante, ISTI-CNR
|
* @author Massimiliano Assante, ISTI-CNR
|
||||||
|
@ -261,6 +263,10 @@ public class NewsFeedPanel extends Composite {
|
||||||
if (feeds != null && allUpdates.size() > 0) {
|
if (feeds != null && allUpdates.size() > 0) {
|
||||||
|
|
||||||
Date myLastUpdateTime = allUpdates.get(0).getFeed().getTime(); //this is the last update in the View
|
Date myLastUpdateTime = allUpdates.get(0).getFeed().getTime(); //this is the last update in the View
|
||||||
|
GWT.log("Last Mine: "+allUpdates.get(0).getFeed().getDescription());
|
||||||
|
|
||||||
|
GWT.log("Last Retr.: "+feeds.get(0).getFeed().getDescription());
|
||||||
|
|
||||||
|
|
||||||
tempCacheNewUpdates = new ArrayList<EnhancedFeed>(); //need to clear it everytime i check (in case someone deleted the updated in the meanwhile)
|
tempCacheNewUpdates = new ArrayList<EnhancedFeed>(); //need to clear it everytime i check (in case someone deleted the updated in the meanwhile)
|
||||||
|
|
||||||
|
@ -296,8 +302,13 @@ public class NewsFeedPanel extends Composite {
|
||||||
|
|
||||||
|
|
||||||
protected void doShowCachedNewUpdates() {
|
protected void doShowCachedNewUpdates() {
|
||||||
newUpdatesPanel.clear(); //remove the aler panel
|
newUpdatesPanel.clear(); //remove the alert panel
|
||||||
for (EnhancedFeed feed : tempCacheNewUpdates) {
|
newsFeedAlert = null; //reset the alert panel and other needed vars
|
||||||
|
currNewUpdatesNo = 0;
|
||||||
|
|
||||||
|
//need to put the in reverse order;
|
||||||
|
for (int i = tempCacheNewUpdates.size(); i > 0; i--) {
|
||||||
|
EnhancedFeed feed = tempCacheNewUpdates.get(i-1);
|
||||||
final TweetTemplate tt = new TweetTemplate(myUserInfo, feed, eventBus, true);
|
final TweetTemplate tt = new TweetTemplate(myUserInfo, feed, eventBus, true);
|
||||||
newsPanel.insert(tt, 0); //insert in the view
|
newsPanel.insert(tt, 0); //insert in the view
|
||||||
allUpdates.add(0, feed); //insert in the model
|
allUpdates.add(0, feed); //insert in the model
|
||||||
|
@ -312,6 +323,41 @@ public class NewsFeedPanel extends Composite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* used when addin directly a feed from the UI (IPC)
|
||||||
|
* @param userid
|
||||||
|
* @param fullName
|
||||||
|
* @param thumbURL
|
||||||
|
* @param description
|
||||||
|
*/
|
||||||
|
public void addJustAddedFeed(ClientFeed cFeed) {
|
||||||
|
Feed feed = new Feed(cFeed.getKey(), FeedType.SHARE, cFeed.getUserid(), cFeed.getTime(), "", cFeed.getUri(), cFeed.getLinkUrlThumbnail(),
|
||||||
|
cFeed.getDescription(), PrivacyLevel.CONNECTION, cFeed.getFullName(),
|
||||||
|
cFeed.getEmail(), cFeed.getThumbnailURL(), cFeed.getLinkTitle(), cFeed.getLinkDescription(), cFeed.getLinkHost());
|
||||||
|
EnhancedFeed toAdd = new EnhancedFeed(feed, false, true); //false cuz he could not have liked this yet and true because is the current user's
|
||||||
|
|
||||||
|
final TweetTemplate tt = new TweetTemplate(myUserInfo, toAdd, eventBus, true);
|
||||||
|
if (isFirstTweet) {
|
||||||
|
newsPanel.clear();
|
||||||
|
newsPanel.add(new Image(spacer));
|
||||||
|
isFirstTweet = false;
|
||||||
|
}
|
||||||
|
newsPanel.insert(tt, 0);
|
||||||
|
Timer t = new Timer() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
tt.setcontentAreaStyle("visible");
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
t.schedule(500);
|
||||||
|
|
||||||
|
//insert it also in the model so that the user who created it do not get notified about this new update
|
||||||
|
allUpdates.add(0, toAdd); //insert in the model
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All Updates
|
* All Updates
|
||||||
*/
|
*/
|
||||||
|
@ -481,41 +527,7 @@ public class NewsFeedPanel extends Composite {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* used when addin directly a feed from the UI (IPC)
|
|
||||||
* @param userid
|
|
||||||
* @param fullName
|
|
||||||
* @param thumbURL
|
|
||||||
* @param description
|
|
||||||
*/
|
|
||||||
public void addJustAddedFeed(ClientFeed cFeed) {
|
|
||||||
Feed feed = new Feed(cFeed.getKey(), FeedType.SHARE, cFeed.getUserid(), null, "", cFeed.getUri(), cFeed.getLinkUrlThumbnail(),
|
|
||||||
cFeed.getDescription(), PrivacyLevel.CONNECTION, cFeed.getFullName(),
|
|
||||||
cFeed.getEmail(), cFeed.getThumbnailURL(), cFeed.getLinkTitle(), cFeed.getLinkDescription(), cFeed.getLinkHost());
|
|
||||||
EnhancedFeed toAdd = new EnhancedFeed(feed, false, true); //false cuz he could not have liked this yet and true because is the current user's
|
|
||||||
|
|
||||||
final TweetTemplate tt = new TweetTemplate(myUserInfo, toAdd, eventBus, true);
|
|
||||||
if (isFirstTweet) {
|
|
||||||
newsPanel.clear();
|
|
||||||
newsPanel.add(new Image(spacer));
|
|
||||||
isFirstTweet = false;
|
|
||||||
}
|
|
||||||
newsPanel.insert(tt, 0);
|
|
||||||
Timer t = new Timer() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
tt.setcontentAreaStyle("visible");
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
t.schedule(500);
|
|
||||||
|
|
||||||
|
|
||||||
//insert it also in the model so that the user who created it do not get notified about this new update
|
|
||||||
allUpdates.add(0, toAdd); //insert in the model
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showLoader() {
|
private void showLoader() {
|
||||||
newsPanel.clear();
|
newsPanel.clear();
|
||||||
|
|
|
@ -245,7 +245,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
ArrayList<Feed> toMerge = new ArrayList<Feed>();
|
ArrayList<Feed> toMerge = new ArrayList<Feed>();
|
||||||
HashMap<String, Feed> feedsMap = new HashMap<String, Feed>();
|
HashMap<String, Feed> feedsMap = new HashMap<String, Feed>();
|
||||||
|
|
||||||
ArrayList<Feed> OrganizationFeeds = (ArrayList<Feed>) store.getRecentFeedsByVRE("/gcube/devsec/devVRE", 15);
|
ArrayList<Feed> OrganizationFeeds = (ArrayList<Feed>) store.getRecentFeedsByVRE("/gcube/devsec/devVRE", 5);
|
||||||
for (Feed feed : OrganizationFeeds) {
|
for (Feed feed : OrganizationFeeds) {
|
||||||
feedsMap.put(feed.getKey(), feed);
|
feedsMap.put(feed.getKey(), feed);
|
||||||
}
|
}
|
||||||
|
@ -638,9 +638,8 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
* @return the refreshingTime in milliseconds
|
* @return the refreshingTime in milliseconds
|
||||||
*/
|
*/
|
||||||
private int getFeedsRefreshTimeInMillis() {
|
private int getFeedsRefreshTimeInMillis() {
|
||||||
//return 20000; //for testing
|
if (withinPortal) {
|
||||||
_log.info("Trying to read custom REFRESH_TIME");
|
_log.info("Trying to read custom REFRESH_TIME");
|
||||||
|
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
int toReturn = 0;
|
int toReturn = 0;
|
||||||
int minutes = 0;
|
int minutes = 0;
|
||||||
|
@ -671,4 +670,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
_log.debug("Returning REFRESH_TIME in millis: " + toReturn + ", (" + minutes + " minutes)");
|
_log.debug("Returning REFRESH_TIME in millis: " + toReturn + ", (" + minutes + " minutes)");
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
return 15000; //15 secs for testing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue