mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-20 19:20:04 +00:00
Bug 4374: Loading Highcharts does not need to be done in a distinct
split point because both usages are merged to one fragment anyway.
This commit is contained in:
1 parent
2bad1681ea
commit
73894e1170
3 files changed
+19
-50
No files matched your search
-26
@@ -1,26 +0,0 @@
|
||||
package com.sap.sailing.gwt.home.desktop;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.RunAsyncCallback;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.sap.sse.gwt.resources.CommonControlsCSS;
|
||||
import com.sap.sse.gwt.resources.Highcharts;
|
||||
|
||||
public class HighChartInjector {
|
||||
public static void loadHighCharts(Runnable afterLoad){
|
||||
GWT.runAsync(new RunAsyncCallback() {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
CommonControlsCSS.ensureInjected();
|
||||
Highcharts.ensureInjected();
|
||||
afterLoad.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable reason) {
|
||||
Window.alert(reason.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+12
-15
@@ -8,7 +8,6 @@ import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.domain.common.dto.EventType;
|
||||
import com.sap.sailing.gwt.home.communication.eventview.EventViewDTO;
|
||||
import com.sap.sailing.gwt.home.desktop.HighChartInjector;
|
||||
import com.sap.sailing.gwt.home.desktop.app.DesktopPlacesNavigator;
|
||||
import com.sap.sailing.gwt.home.desktop.app.WithHeader;
|
||||
import com.sap.sailing.gwt.home.desktop.places.event.multiregatta.AbstractMultiregattaEventPlace;
|
||||
@@ -24,6 +23,8 @@ import com.sap.sailing.gwt.home.shared.places.event.AbstractEventActivityProxy;
|
||||
import com.sap.sailing.gwt.home.shared.places.event.AbstractEventPlace;
|
||||
import com.sap.sailing.gwt.home.shared.places.event.EventContext;
|
||||
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
|
||||
import com.sap.sse.gwt.resources.CommonControlsCSS;
|
||||
import com.sap.sse.gwt.resources.Highcharts;
|
||||
|
||||
public class EventActivityProxy extends AbstractEventActivityProxy<EventClientFactory> implements WithHeader {
|
||||
|
||||
@@ -41,20 +42,16 @@ public class EventActivityProxy extends AbstractEventActivityProxy<EventClientFa
|
||||
GWT.runAsync(new AbstractRunAsyncCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
HighChartInjector.loadHighCharts(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (place instanceof AbstractEventRegattaPlace) {
|
||||
withFlagImageResolver(flagImageResolver -> new EventRegattaActivity((AbstractEventRegattaPlace) place, event, clientFactory,
|
||||
homePlacesNavigator, getNavigationPathDisplay(), flagImageResolver));
|
||||
}
|
||||
if (place instanceof AbstractMultiregattaEventPlace) {
|
||||
onSuccess(new EventMultiregattaActivity((AbstractMultiregattaEventPlace) place, event,
|
||||
clientFactory, homePlacesNavigator, getNavigationPathDisplay()));
|
||||
}
|
||||
}
|
||||
});
|
||||
CommonControlsCSS.ensureInjected();
|
||||
Highcharts.ensureInjected();
|
||||
if (place instanceof AbstractEventRegattaPlace) {
|
||||
withFlagImageResolver(flagImageResolver -> new EventRegattaActivity((AbstractEventRegattaPlace) place, event, clientFactory,
|
||||
homePlacesNavigator, getNavigationPathDisplay(), flagImageResolver));
|
||||
}
|
||||
if (place instanceof AbstractMultiregattaEventPlace) {
|
||||
onSuccess(new EventMultiregattaActivity((AbstractMultiregattaEventPlace) place, event,
|
||||
clientFactory, homePlacesNavigator, getNavigationPathDisplay()));
|
||||
}
|
||||
}
|
||||
private void withFlagImageResolver(final Function<FlagImageResolver, Activity> activityFactory) {
|
||||
final Consumer<Activity> onSuccess = super::onSuccess;
|
||||
|
||||
+7
-9
@@ -10,7 +10,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.gwt.home.client.place.event.legacy.SeriesClientFactory;
|
||||
import com.sap.sailing.gwt.home.communication.fakeseries.EventSeriesViewDTO;
|
||||
import com.sap.sailing.gwt.home.communication.fakeseries.GetEventSeriesViewAction;
|
||||
import com.sap.sailing.gwt.home.desktop.HighChartInjector;
|
||||
import com.sap.sailing.gwt.home.desktop.app.DesktopPlacesNavigator;
|
||||
import com.sap.sailing.gwt.home.desktop.app.WithHeader;
|
||||
import com.sap.sailing.gwt.home.desktop.places.fakeseries.eventstab.SeriesEventsPlace;
|
||||
@@ -24,6 +23,8 @@ import com.sap.sailing.gwt.home.shared.places.fakeseries.SeriesContext;
|
||||
import com.sap.sailing.gwt.home.shared.places.fakeseries.SeriesDefaultPlace;
|
||||
import com.sap.sailing.gwt.ui.client.FlagImageResolver;
|
||||
import com.sap.sse.gwt.client.mvp.AbstractActivityProxy;
|
||||
import com.sap.sse.gwt.resources.CommonControlsCSS;
|
||||
import com.sap.sse.gwt.resources.Highcharts;
|
||||
|
||||
public class SeriesActivityProxy extends AbstractActivityProxy implements ProvidesNavigationPath, WithHeader {
|
||||
|
||||
@@ -66,14 +67,11 @@ public class SeriesActivityProxy extends AbstractActivityProxy implements Provid
|
||||
place = getRealPlace(series);
|
||||
}
|
||||
place = verifyAndAdjustPlace();
|
||||
HighChartInjector.loadHighCharts(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
withFlagImageResolver(flagImageResolver -> new SeriesActivity((AbstractSeriesTabPlace) place, series, clientFactory,
|
||||
homePlacesNavigator, navigationPathDisplay, flagImageResolver));
|
||||
}
|
||||
});
|
||||
|
||||
CommonControlsCSS.ensureInjected();
|
||||
Highcharts.ensureInjected();
|
||||
withFlagImageResolver(flagImageResolver -> new SeriesActivity((AbstractSeriesTabPlace) place, series, clientFactory,
|
||||
homePlacesNavigator, navigationPathDisplay, flagImageResolver));
|
||||
}
|
||||
private void withFlagImageResolver(final Function<FlagImageResolver, Activity> activityFactory) {
|
||||
final Consumer<Activity> onSuccess = super::onSuccess;
|
||||
|
||||
Reference in new issue
Block a user