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>() {
|
private final RefreshableWidget<EventOverviewStageDTO> refreshable = new RefreshableWidget<EventOverviewStageDTO>() {
|
||||||
@Override
|
@Override
|
||||||
public void setData(EventOverviewStageDTO data, long nextUpdate, int updateNo) {
|
public void setData(EventOverviewStageDTO data) {
|
||||||
setStageData(data);
|
setStageData(data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private final RefreshableWidget<ListResult<NewsEntryDTO>> newsRefreshable = new RefreshableWidget<ListResult<NewsEntryDTO>>() {
|
private final RefreshableWidget<ListResult<NewsEntryDTO>> newsRefreshable = new RefreshableWidget<ListResult<NewsEntryDTO>>() {
|
||||||
@Override
|
@Override
|
||||||
public void setData(ListResult<NewsEntryDTO> data, long nextUpdate, int updateNo) {
|
public void setData(ListResult<NewsEntryDTO> data) {
|
||||||
setNews(data.getValues());
|
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.ArrayList;
|
||||||
import java.util.List;
|
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;
|
||||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
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;
|
import com.sap.sailing.gwt.ui.shared.dispatch.ResultWithTTL;
|
||||||
|
|
||||||
public class RefreshManager {
|
public class RefreshManager {
|
||||||
|
private static final Logger LOG = Logger.getLogger(RefreshManager.class.getName());
|
||||||
|
|
||||||
private static final long PAUSE_ON_ERROR = 1000 * 30;
|
private static final long PAUSE_ON_ERROR = 1000 * 30;
|
||||||
private List<RefreshHolder<DTO, Action<ResultWithTTL<DTO>>>> refreshables = new ArrayList<>();
|
private List<RefreshHolder<DTO, Action<ResultWithTTL<DTO>>>> refreshables = new ArrayList<>();
|
||||||
@@ -47,16 +50,14 @@ public class RefreshManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int updateNo;
|
|
||||||
|
|
||||||
private void update() {
|
private void update() {
|
||||||
updateNo++;
|
|
||||||
for (final RefreshHolder<DTO, Action<ResultWithTTL<DTO>>> refreshable : refreshables) {
|
for (final RefreshHolder<DTO, Action<ResultWithTTL<DTO>>> refreshable : refreshables) {
|
||||||
// Everything that needs refresh within the next 5000ms will be refreshed now.
|
// Everything that needs refresh within the next 5000ms will be refreshed now.
|
||||||
// This makes it possible to use batching resulting in less requests.
|
// This makes it possible to use batching resulting in less requests.
|
||||||
if (!refreshable.callRunning && refreshable.timeout < System.currentTimeMillis() + 5000) {
|
if (!refreshable.callRunning && refreshable.timeout < System.currentTimeMillis() + 5000) {
|
||||||
refreshable.callRunning = true;
|
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
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
refreshable.callRunning = false;
|
refreshable.callRunning = false;
|
||||||
@@ -68,7 +69,11 @@ public class RefreshManager {
|
|||||||
public void onSuccess(ResultWithTTL<DTO> result) {
|
public void onSuccess(ResultWithTTL<DTO> result) {
|
||||||
refreshable.callRunning = false;
|
refreshable.callRunning = false;
|
||||||
refreshable.timeout = System.currentTimeMillis() + result.getTtl();
|
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();
|
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;
|
import com.sap.sailing.gwt.ui.shared.dispatch.DTO;
|
||||||
|
|
||||||
public interface RefreshableWidget<D extends 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) {
|
public void setAction(String infoText, final PlaceNavigation<?> placeNavigation) {
|
||||||
headerUi.setInfoText(infoText);
|
headerUi.setInfoText(infoText);
|
||||||
headerUi.setClickAction(placeNavigation);
|
headerUi.setClickAction(placeNavigation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setData(final GetMiniLeaderboardDTO data) {
|
public void setData(final GetMiniLeaderboardDTO data) {
|
||||||
itemContainerUi.clearContent();
|
itemContainerUi.clearContent();
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ public class RegattaStatus extends Composite implements RefreshableWidget<Regatt
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setData(RegattasAndLiveRacesDTO data, long nextUpdate, int updateNo) {
|
public void setData(RegattasAndLiveRacesDTO data) {
|
||||||
regattaContainerUi.clearContent();
|
regattaContainerUi.clearContent();
|
||||||
collapsableContainerUi.clearContent();
|
collapsableContainerUi.clearContent();
|
||||||
if (data.hasRegattasWithRaces()) {
|
if (data.hasRegattasWithRaces()) {
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ public class StatisticsBox extends Composite implements RefreshableWidget<EventS
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setData(EventStatisticsDTO statistics, long nextUpdate, int updateNo) {
|
public void setData(EventStatisticsDTO statistics) {
|
||||||
itemContainerUi.clearContent();
|
itemContainerUi.clearContent();
|
||||||
if (showRegattaInformation) {
|
if (showRegattaInformation) {
|
||||||
addItem(StatisticsBox.ICON_REGATTAS_FOUGHT, MSG.regattas(), statistics.getRegattasFoughtCount());
|
addItem(StatisticsBox.ICON_REGATTAS_FOUGHT, MSG.regattas(), statistics.getRegattasFoughtCount());
|
||||||
|
|||||||
+1
-1
@@ -48,7 +48,7 @@ public class UpdatesBox extends Composite implements RefreshableWidget<ListResul
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@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());
|
setData(data == null ? null :data.getValues());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ public class EventOverviewStage extends Composite implements RefreshableWidget<E
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setData(EventOverviewStageDTO stageData, long nextUpdate, int updateNo) {
|
public void setData(EventOverviewStageDTO stageData) {
|
||||||
message.setMessage(stageData.getEventMessage());
|
message.setMessage(stageData.getEventMessage());
|
||||||
|
|
||||||
EventOverviewStageContentDTO data = stageData.getStageContent();
|
EventOverviewStageContentDTO data = stageData.getStageContent();
|
||||||
|
|||||||
Reference in new issue
Block a user