mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-28 14:57:12 +00:00
Merge branch 'design2015' into design2015-races
Conflicts: java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/client/place/event/partials/raceListLive/RacesListLive.java
This commit is contained in:
commit
e0e9ac8889
8 files changed
+18
-17
No files matched your search
+2
-2
@@ -33,13 +33,13 @@ public class EventOverviewStage extends Composite {
|
||||
|
||||
private final RefreshableWidget<EventOverviewStageDTO> refreshable = new RefreshableWidget<EventOverviewStageDTO>() {
|
||||
@Override
|
||||
public void setData(EventOverviewStageDTO data, long nextUpdate, int updateNo) {
|
||||
public void setData(EventOverviewStageDTO data) {
|
||||
setStageData(data);
|
||||
}
|
||||
};
|
||||
private final RefreshableWidget<ListResult<NewsEntryDTO>> newsRefreshable = new RefreshableWidget<ListResult<NewsEntryDTO>>() {
|
||||
@Override
|
||||
public void setData(ListResult<NewsEntryDTO> data, long nextUpdate, int updateNo) {
|
||||
public void setData(ListResult<NewsEntryDTO> data) {
|
||||
setNews(data.getValues());
|
||||
}
|
||||
};
|
||||
|
||||
+10
-5
@@ -2,6 +2,8 @@ package com.sap.sailing.gwt.home.client.place.event.regatta.tabs.reload;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
@@ -17,6 +19,7 @@ import com.sap.sailing.gwt.ui.shared.dispatch.DTO;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.ResultWithTTL;
|
||||
|
||||
public class RefreshManager {
|
||||
private static final Logger LOG = Logger.getLogger(RefreshManager.class.getName());
|
||||
|
||||
private static final long PAUSE_ON_ERROR = 1000 * 30;
|
||||
private List<RefreshHolder<DTO, Action<ResultWithTTL<DTO>>>> refreshables = new ArrayList<>();
|
||||
@@ -47,16 +50,14 @@ public class RefreshManager {
|
||||
});
|
||||
}
|
||||
|
||||
private int updateNo;
|
||||
|
||||
private void update() {
|
||||
updateNo++;
|
||||
for (final RefreshHolder<DTO, Action<ResultWithTTL<DTO>>> refreshable : refreshables) {
|
||||
// Everything that needs refresh within the next 5000ms will be refreshed now.
|
||||
// This makes it possible to use batching resulting in less requests.
|
||||
if (!refreshable.callRunning && refreshable.timeout < System.currentTimeMillis() + 5000) {
|
||||
refreshable.callRunning = true;
|
||||
actionExecutor.execute(refreshable.provider.getAction(), new AsyncCallback<ResultWithTTL<DTO>>() {
|
||||
final Action<ResultWithTTL<DTO>> action = refreshable.provider.getAction();
|
||||
actionExecutor.execute(action, new AsyncCallback<ResultWithTTL<DTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
refreshable.callRunning = false;
|
||||
@@ -68,7 +69,11 @@ public class RefreshManager {
|
||||
public void onSuccess(ResultWithTTL<DTO> result) {
|
||||
refreshable.callRunning = false;
|
||||
refreshable.timeout = System.currentTimeMillis() + result.getTtl();
|
||||
refreshable.widget.setData(result.getDto(), refreshable.timeout, updateNo);
|
||||
try {
|
||||
refreshable.widget.setData(result.getDto());
|
||||
} catch(Throwable error) {
|
||||
LOG.log(Level.SEVERE, "Error while refreshing content with action " + action.getClass().getName(), error);
|
||||
}
|
||||
reschedule();
|
||||
}
|
||||
});
|
||||
|
||||
+1
-1
@@ -3,5 +3,5 @@ package com.sap.sailing.gwt.home.client.place.event.regatta.tabs.reload;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.DTO;
|
||||
|
||||
public interface RefreshableWidget<D extends DTO> {
|
||||
void setData(D data, long nextUpdate, int updateNo);
|
||||
void setData(D data);
|
||||
}
|
||||
+1
-5
@@ -38,17 +38,13 @@ public class MinileaderboardBox extends Composite implements RefreshableWidget<G
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(final GetMiniLeaderboardDTO data, long nextUpdate, int updateNo) {
|
||||
setData(data);
|
||||
}
|
||||
|
||||
public void setAction(String infoText, final PlaceNavigation<?> placeNavigation) {
|
||||
headerUi.setInfoText(infoText);
|
||||
headerUi.setClickAction(placeNavigation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(final GetMiniLeaderboardDTO data) {
|
||||
itemContainerUi.clearContent();
|
||||
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ public class RegattaStatus extends Composite implements RefreshableWidget<Regatt
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(RegattasAndLiveRacesDTO data, long nextUpdate, int updateNo) {
|
||||
public void setData(RegattasAndLiveRacesDTO data) {
|
||||
regattaContainerUi.clearContent();
|
||||
collapsableContainerUi.clearContent();
|
||||
if (data.hasRegattasWithRaces()) {
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ public class StatisticsBox extends Composite implements RefreshableWidget<EventS
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(EventStatisticsDTO statistics, long nextUpdate, int updateNo) {
|
||||
public void setData(EventStatisticsDTO statistics) {
|
||||
itemContainerUi.clearContent();
|
||||
if (showRegattaInformation) {
|
||||
addItem(StatisticsBox.ICON_REGATTAS_FOUGHT, MSG.regattas(), statistics.getRegattasFoughtCount());
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public class UpdatesBox extends Composite implements RefreshableWidget<ListResul
|
||||
|
||||
|
||||
@Override
|
||||
public void setData(final ListResult<NewsEntryDTO> data, long nextUpdate, int updateNo) {
|
||||
public void setData(final ListResult<NewsEntryDTO> data) {
|
||||
setData(data == null ? null :data.getValues());
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public class EventOverviewStage extends Composite implements RefreshableWidget<E
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setData(EventOverviewStageDTO stageData, long nextUpdate, int updateNo) {
|
||||
public void setData(EventOverviewStageDTO stageData) {
|
||||
message.setMessage(stageData.getEventMessage());
|
||||
|
||||
EventOverviewStageContentDTO data = stageData.getStageContent();
|
||||
|
||||
Reference in new issue
Block a user