Merge branch 'master' into android_apps

Conflicts:
	java/com.sap.sailing.gwt.ui/SailingGWT.launch
	java/com.sap.sailing.server.gateway.serialization/src/com/sap/sailing/server/gateway/deserialization/impl/FlatSmartphoneUuidAndGPSFixMovingJsonDeserializer.java
	mobile/com.sap.sailing.android.tracking.app/src/com/sap/sailing/android/tracking/app/services/TrackingService.java
This commit is contained in:
Peter Siegmund committed 2014-11-19 07:58:37 +01:00
commit fc5cabb080
133 files changed
+2035 -1267

No files matched your search

+2 -1
View File
@@ -177,8 +177,9 @@ fi
if [[ "$@" == "clean" ]]; then
cd $PROJECT_HOME/java
cd $PROJECT_HOME/java
rm -rf com.sap.$PROJECT_TYPE.gwt.ui/com.sap.$PROJECT_TYPE.*
rm -rf com.sap.sse.security.ui/com.sap.sse.security.ui.*
cd $PROJECT_HOME
echo "Using following command: mvn $extra -DargLine=\"$APP_PARAMETERS\" -fae -s $MAVEN_SETTINGS $clean"
echo "Maven version used: `mvn --version`"
+38
View File
@@ -19,6 +19,30 @@ start_tmux() {
}
start_servers() {
launch_httpd=false
VARS=`/opt/amazon/bin/ec2-metadata -d | sed "s/user-data\: //g" | grep -v "^not available$"`
for var in $VARS; do
echo "$var" | grep -q "^SERVER_NAME="
if [ "$?" != "0" ]; then
eval "export $var"
fi
echo "$var" | grep -q "^SERVER_PORT="
if [ "$?" != "0" ]; then
eval "export $var"
fi
echo "$var" | grep -q "^EVENT_ID="
if [ "$?" != "0" ]; then
eval "export $var"
fi
echo "$var" | grep -iq "^REPLICATE_ON_START=True"
if [ "$?" != "0" ]; then
launch_httpd=true
fi
done
if [ "$launch_httpd" = "true" ]; then
launch_httpd $SERVER_NAME $SERVER_PORT $EVENT_ID
fi
for conf in $JAVA_START_INSTANCES; do
echo "Checking for amazon update..."
su - sailing -c "cd /home/sailing/servers/$conf && $GIT_REPOSITORY/java/target/refreshInstance.sh auto-install" 2>/var/log/sailing.err >/var/log/sailing.out
@@ -36,7 +60,21 @@ stop_servers() {
RETVAL=$?
[ $RETVAL -eq 0 ] && success || failure
done
}
# launch_httpd(server_name, port, event_id)
launch_httpd() {
echo "launch_httpd($1, $2, $2)"
if [ -x /etc/init.d/httpd ]; then
server_name="`echo $1 | tr [A-Z] [a-z]`"
port="$2"
event_id="$3"
echo "Use Event $server_name.sapsailing.com \"$event_id\" 127.0.0.1 $port" >>/etc/httpd/conf.d/001-events.conf
echo "Launching httpd to map ${server_name}.sapsailing.com to event with ID $event_id with server running on local port $port..."
service httpd start
else
echo Can't launch httpd; start script doesn't seem to be installed at /etc/init.d/httpd
fi
}
# See how we were called.
@@ -89,12 +89,10 @@ public enum BoatClassMasterdata {
public static BoatClassMasterdata resolveBoatClass(String boatClassName) {
String boatClassNameToResolve = unifyBoatClassName(boatClassName);
for (BoatClassMasterdata boatClass : values()) {
if (unifyBoatClassName(boatClass.displayName).equals(boatClassNameToResolve)) {
return boatClass;
}
if(boatClass.alternativeNames != null) {
} else if (boatClass.alternativeNames != null) {
for (String name : boatClass.alternativeNames) {
if (unifyBoatClassName(name).equals(boatClassNameToResolve)) {
return boatClass;
@@ -3,8 +3,9 @@ package com.sap.sailing.domain.common.dto;
import java.io.Serializable;
import com.sap.sailing.domain.common.Color;
import com.sap.sailing.domain.common.racelog.tracking.MappableToDevice;
public interface CompetitorDTO extends Serializable {
public interface CompetitorDTO extends Serializable, MappableToDevice {
String getTwoLetterIsoCountryCode();
@@ -0,0 +1,13 @@
package com.sap.sailing.domain.common.racelog.tracking;
/**
* Marker interface that can be applied to DTOs that represent domain objects
* that can be mapped to a device for racelog-tracking (see {@link DeviceMapping}.
* By doing so, they can be referred without having to use {@link Serializable}
* as type - which has a considerable performance impact for GWT.
* @author Fredrik Teschke
*
*/
public interface MappableToDevice {
}
@@ -22,7 +22,7 @@ import com.sap.sailing.domain.racelog.impl.RaceLogEventAuthorImpl;
import com.sap.sailing.domain.racelog.impl.RaceLogImpl;
import com.sap.sailing.domain.racelog.tracking.DeviceIdentifier;
import com.sap.sailing.domain.racelog.tracking.GPSFixStore;
import com.sap.sailing.domain.racelog.tracking.test.mock.MockDeviceAndSessioinIdentifierWithGPSFixesDeserializer;
import com.sap.sailing.domain.racelog.tracking.test.mock.MockDeviceAndSessionIdentifierWithGPSFixesDeserializer;
import com.sap.sailing.domain.racelog.tracking.test.mock.MockSmartphoneImeiServiceFinderFactory;
import com.sap.sailing.domain.racelog.tracking.test.mock.SmartphoneImeiIdentifier;
import com.sap.sailing.domain.tracking.GPSFixMoving;
@@ -36,7 +36,7 @@ public class AbstractGPSFixStoreTest {
protected RacingEventService service;
protected final MockSmartphoneImeiServiceFinderFactory serviceFinderFactory = new MockSmartphoneImeiServiceFinderFactory();
DeviceAndSessionIdentifierWithGPSFixesDeserializer deserializer =
new MockDeviceAndSessioinIdentifierWithGPSFixesDeserializer();
new MockDeviceAndSessionIdentifierWithGPSFixesDeserializer();
protected final DeviceIdentifier device = new SmartphoneImeiIdentifier("a");
protected RaceLog raceLog;
protected GPSFixStore store;
@@ -70,10 +70,10 @@ public class CreateAndTrackWithRaceLogTest {
gpsFixStore = service.getGPSFixStore();
service.getMongoObjectFactory().getDatabase().dropDatabase();
author = service.getServerAuthor();
Series series = new SeriesImpl("series", false, Collections.singletonList(fleet),
Collections.singletonList(columnName), service);
Series series = new SeriesImpl("series", false, Collections.singletonList(fleet), Collections.emptySet(), service);
regatta = service.createRegatta(RegattaImpl.getDefaultName("regatta", "Laser"), "Laser", UUID.randomUUID(), Collections.<Series>singletonList(series),
false, new HighPoint(), UUID.randomUUID(), /* useStartTimeInference */ true);
series.addRaceColumn(columnName, /* trackedRegattaRegistry */ null);
leaderboard = service.addRegattaLeaderboard(regatta.getRegattaIdentifier(), "RegattaLeaderboard", new int[] {});
adapter = RaceLogTrackingAdapterFactoryImpl.INSTANCE.getAdapter(DomainFactory.INSTANCE);
}
@@ -1,64 +0,0 @@
package com.sap.sailing.domain.racelogtracking.test.impl;
import static com.sap.sse.common.Util.size;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import com.sap.sailing.domain.base.Competitor;
import com.sap.sailing.domain.common.racelog.tracking.NoCorrespondingServiceRegisteredException;
import com.sap.sailing.domain.common.racelog.tracking.TransformationException;
import com.sap.sailing.domain.racelog.tracking.DeviceIdentifier;
import com.sap.sailing.domain.racelog.tracking.test.mock.MockDeviceAndSessioinIdentifierWithGPSFixesDeserializer;
import com.sap.sailing.domain.racelog.tracking.test.mock.SmartphoneImeiIdentifier;
import com.sap.sailing.domain.racelogtracking.servlet.RecordFixesPostServlet;
import com.sap.sailing.domain.racelogtracking.test.AbstractGPSFixStoreTest;
import com.sap.sailing.domain.tracking.GPSFix;
import com.sap.sailing.domain.tracking.GPSFixMoving;
import com.sap.sailing.domain.tracking.impl.DynamicGPSFixMovingTrackImpl;
import com.sap.sailing.server.gateway.deserialization.impl.DeviceAndSessionIdentifierWithGPSFixesDeserializer;
import com.sap.sse.common.Util;
public class RecordFixesTest extends AbstractGPSFixStoreTest {
private RecordFixesPostServlet servlet;
private final DeviceAndSessionIdentifierWithGPSFixesDeserializer deserializer =
new MockDeviceAndSessioinIdentifierWithGPSFixesDeserializer();
private final DeviceIdentifier device = new SmartphoneImeiIdentifier("a");
@Before
public void setupServlet() {
servlet = new RecordFixesPostServlet();
servlet = spy(servlet);
when(servlet.getRequestDeserializer()).thenReturn(deserializer);
doReturn(service).when(servlet).getService();
}
@Test
public void areFixesStoredInDb() throws TransformationException, NoCorrespondingServiceRegisteredException {
map(comp, device, 0, 600);
int timepoint = 343;
List<GPSFix> fixes = new ArrayList<>();
fixes.add(createFix(timepoint, 0, 0, 0, 0));
fixes.add(createFix(timepoint+1, 0, 0, 0, 0));
Util.Triple<DeviceIdentifier, Serializable, List<GPSFix>> data = new Util.Triple<>(device, null, fixes);
servlet.process(null, data);
DynamicGPSFixMovingTrackImpl<Competitor> track = new DynamicGPSFixMovingTrackImpl<>(comp, 0);
store.loadCompetitorTrack(track, raceLog, comp);
track.lockForRead();
assertEquals(2, size(track.getRawFixes()));
assertEquals(timepoint, track.getFirstRawFix().getTimePoint().asMillis());
assertTrue(track.getFirstRawFix() instanceof GPSFixMoving);
track.unlockAfterRead();
}
}
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="output" path="bin"/>
</classpath>
@@ -1,7 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.source=1.8
@@ -4,7 +4,7 @@ Bundle-Name: Testsupport
Bundle-SymbolicName: com.sap.sailing.domain.racelogtrackingadapter.testsupport
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: SAP
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: com.sap.sailing.domain.shared.android,
com.sap.sailing.domain,
com.sap.sailing.domain.common,
@@ -3,11 +3,11 @@ package com.sap.sailing.domain.racelog.tracking.test.mock;
import com.sap.sailing.server.gateway.deserialization.impl.DeviceAndSessionIdentifierWithGPSFixesDeserializer;
import com.sap.sailing.server.gateway.deserialization.impl.DeviceIdentifierJsonDeserializer;
public class MockDeviceAndSessioinIdentifierWithGPSFixesDeserializer extends
public class MockDeviceAndSessionIdentifierWithGPSFixesDeserializer extends
DeviceAndSessionIdentifierWithGPSFixesDeserializer {
public MockDeviceAndSessioinIdentifierWithGPSFixesDeserializer() {
super(new MockGPSFixJsonServiceFinder(),
public MockDeviceAndSessionIdentifierWithGPSFixesDeserializer() {
super(new MockServiceFinder<>(new MockGPSFixJsonHandler()),
DeviceIdentifierJsonDeserializer.create(new SmartphoneImeiJsonHandler(), SmartphoneImeiIdentifier.TYPE));
}
@@ -1,21 +0,0 @@
package com.sap.sailing.domain.racelog.tracking.test.mock;
import com.sap.sailing.domain.common.racelog.tracking.TypeBasedServiceFinder;
import com.sap.sailing.server.gateway.deserialization.impl.GPSFixMovingJsonDeserializer;
import com.sap.sailing.server.gateway.serialization.racelog.tracking.GPSFixJsonHandler;
public class MockGPSFixJsonServiceFinder implements TypeBasedServiceFinder<GPSFixJsonHandler> {
private final MockGPSFixJsonHandler handler = new MockGPSFixJsonHandler();
@Override
public GPSFixJsonHandler findService(String fixType) {
if (fixType.equals(GPSFixMovingJsonDeserializer.TYPE)) {
return handler;
}
return null;
}
@Override
public void setFallbackService(GPSFixJsonHandler fallback) {
}
}
@@ -0,0 +1,23 @@
package com.sap.sailing.domain.racelog.tracking.test.mock;
import com.sap.sailing.domain.common.racelog.tracking.TypeBasedServiceFinder;
public class MockServiceFinder<T> implements TypeBasedServiceFinder<T> {
private final T handler;
private T fallback;
public MockServiceFinder(T handler) {
this.handler = handler;
}
@Override
public T findService(String deviceType) {
if (deviceType.equals(SmartphoneImeiIdentifier.TYPE)) return handler;
return fallback;
}
@Override
public void setFallbackService(T fallback) {
this.fallback = fallback;
}
}
@@ -1,28 +0,0 @@
package com.sap.sailing.domain.racelog.tracking.test.mock;
import com.sap.sailing.domain.common.racelog.tracking.TypeBasedServiceFinder;
import com.sap.sailing.server.gateway.serialization.racelog.tracking.DeviceIdentifierJsonHandler;
/**
* A simplified implementation of the {@link TypeBasedServiceFinder} interface that, when the device type
* {@link SmartphoneImeiIdentifier#TYPE} is requested, returns a specific handler that was passed to this object's
* constructor.
*
* @author Fredrik Teschke
*
*/
public class MockSmartphoneImeiJsonServiceFinder implements TypeBasedServiceFinder<DeviceIdentifierJsonHandler> {
private final SmartphoneImeiJsonHandler handler = new SmartphoneImeiJsonHandler();
private DeviceIdentifierJsonHandler fallback;
@Override
public DeviceIdentifierJsonHandler findService(String deviceType) {
if (deviceType.equals(SmartphoneImeiIdentifier.TYPE)) return handler;
return fallback;
}
@Override
public void setFallbackService(DeviceIdentifierJsonHandler fallback) {
this.fallback = fallback;
}
}
@@ -1,28 +0,0 @@
package com.sap.sailing.domain.racelog.tracking.test.mock;
import com.sap.sailing.domain.common.racelog.tracking.TypeBasedServiceFinder;
import com.sap.sailing.domain.persistence.racelog.tracking.DeviceIdentifierMongoHandler;
/**
* A simplified implementation of the {@link TypeBasedServiceFinder} interface that, when the device type
* {@link SmartphoneImeiIdentifier#TYPE} is requested, returns a specific handler that was passed to this object's
* constructor.
*
* @author Fredrik Teschke
*
*/
public class MockSmartphoneImeiMongoServiceFinder implements TypeBasedServiceFinder<DeviceIdentifierMongoHandler> {
private final SmartphoneImeiMongoHandler handler = new SmartphoneImeiMongoHandler();
private DeviceIdentifierMongoHandler fallback;
@Override
public DeviceIdentifierMongoHandler findService(String deviceType) {
if (deviceType.equals(SmartphoneImeiIdentifier.TYPE)) return handler;
return fallback;
}
@Override
public void setFallbackService(DeviceIdentifierMongoHandler fallback) {
this.fallback = fallback;
}
}
@@ -22,10 +22,10 @@ public class MockSmartphoneImeiServiceFinderFactory implements TypeBasedServiceF
Map<Class<?>, TypeBasedServiceFinder<?>> serviceFinders = new HashMap<Class<?>, TypeBasedServiceFinder<?>>();
public MockSmartphoneImeiServiceFinderFactory() {
serviceFinders.put(DeviceIdentifierMongoHandler.class, new MockSmartphoneImeiMongoServiceFinder());
serviceFinders.put(DeviceIdentifierJsonHandler.class, new MockSmartphoneImeiJsonServiceFinder());
serviceFinders.put(DeviceIdentifierMongoHandler.class, new MockServiceFinder<>(new SmartphoneImeiMongoHandler()));
serviceFinders.put(DeviceIdentifierJsonHandler.class, new MockServiceFinder<>(new SmartphoneImeiJsonHandler()));
serviceFinders.put(GPSFixMongoHandler.class, new MockGPSFixMongoServiceFinder());
serviceFinders.put(GPSFixJsonHandler.class, new MockGPSFixJsonServiceFinder());
serviceFinders.put(GPSFixJsonHandler.class, new MockServiceFinder<>(new MockGPSFixJsonHandler()));
}
@SuppressWarnings("unchecked")
@@ -0,0 +1,38 @@
package com.sap.sailing.domain.racelog.tracking.test.mock;
import java.util.HashMap;
import java.util.Map;
import com.sap.sailing.domain.common.racelog.tracking.TypeBasedServiceFinder;
import com.sap.sailing.domain.common.racelog.tracking.TypeBasedServiceFinderFactory;
import com.sap.sailing.domain.persistence.racelog.tracking.DeviceIdentifierMongoHandler;
import com.sap.sailing.domain.persistence.racelog.tracking.GPSFixMongoHandler;
import com.sap.sailing.domain.racelogtracking.impl.SmartphoneUUIDMongoHandler;
import com.sap.sailing.server.gateway.serialization.racelog.tracking.DeviceIdentifierJsonHandler;
import com.sap.sailing.server.gateway.serialization.racelog.tracking.GPSFixJsonHandler;
import com.sap.sailing.server.gateway.serialization.racelog.tracking.impl.SmartphoneUUIDJsonHandler;
/**
* A simplified implementation of the {@link TypeBasedServiceFinder} interface that, when the device type
* {@link SmartphoneImeiIdentifier#TYPE} is requested, returns a specific handler that was passed to this object's
* constructor.
*
* @author Fredrik Teschke
*
*/
public class MockSmartphoneUuidServiceFinderFactory implements TypeBasedServiceFinderFactory {
Map<Class<?>, TypeBasedServiceFinder<?>> serviceFinders = new HashMap<Class<?>, TypeBasedServiceFinder<?>>();
public MockSmartphoneUuidServiceFinderFactory() {
serviceFinders.put(DeviceIdentifierMongoHandler.class, new MockServiceFinder<>(new SmartphoneUUIDMongoHandler()));
serviceFinders.put(DeviceIdentifierJsonHandler.class, new MockServiceFinder<>(new SmartphoneUUIDJsonHandler()));
serviceFinders.put(GPSFixMongoHandler.class, new MockGPSFixMongoServiceFinder());
serviceFinders.put(GPSFixJsonHandler.class, new MockServiceFinder<>(new MockGPSFixJsonHandler()));
}
@SuppressWarnings("unchecked")
@Override
public <ServiceT> TypeBasedServiceFinder<ServiceT> createServiceFinder(Class<ServiceT> clazz) {
return (TypeBasedServiceFinder<ServiceT>) serviceFinders.get(clazz);
}
}
@@ -22,7 +22,5 @@ Import-Package: com.mongodb,
org.json.simple.parser,
org.osgi.framework;version="1.6.0"
Export-Package: com.sap.sailing.domain.racelogtracking,
com.sap.sailing.domain.racelogtracking.impl;x-friends:="com.sap.sailing.domain.racelogtrackingadapter.testsupport,com.sap.sailing.gwt.ui.test",
com.sap.sailing.domain.racelogtracking.servlet;x-friends:="com.sap.sailing.domain.racelogtrackingadapter.test"
Web-ContextPath: /tracking
com.sap.sailing.domain.racelogtracking.impl;x-friends:="com.sap.sailing.domain.racelogtrackingadapter.testsupport,com.sap.sailing.gwt.ui.test"
Bundle-Activator: com.sap.sailing.domain.racelogtracking.impl.Activator
@@ -1,37 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<!-- Disable directory listing: -->
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>org.eclipse.jetty.servlet.DefaultServlet
</servlet-class>
<init-param>
<param-name>dirAllowed</param-name>
<param-value>false</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>RecordFixesPostServlet</servlet-name>
<servlet-class>com.sap.sailing.domain.racelogtracking.servlet.RecordFixesPostServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RecordFixesPostServlet</servlet-name>
<url-pattern>/recordFixes</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>RecordFixesFlatJsonPostServlet</servlet-name>
<servlet-class>com.sap.sailing.domain.racelogtracking.servlet.RecordFixesFlatJsonPostServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RecordFixesFlatJsonPostServlet</servlet-name>
<url-pattern>/recordFixesFlatJson</url-pattern>
</servlet-mapping>
</web-app>
@@ -1,51 +0,0 @@
package com.sap.sailing.domain.racelogtracking.servlet;
import java.util.Map;
import java.util.UUID;
import java.util.logging.Level;
import com.sap.sailing.domain.common.racelog.tracking.NoCorrespondingServiceRegisteredException;
import com.sap.sailing.domain.common.racelog.tracking.TransformationException;
import com.sap.sailing.domain.racelog.tracking.DeviceIdentifier;
import com.sap.sailing.domain.racelog.tracking.impl.SmartphoneUUIDIdentifierImpl;
import com.sap.sailing.domain.tracking.GPSFixMoving;
import com.sap.sailing.server.gateway.AbstractJsonPostServlet;
import com.sap.sailing.server.gateway.HttpExceptionWithMessage;
import com.sap.sailing.server.gateway.deserialization.JsonDeserializer;
import com.sap.sailing.server.gateway.deserialization.impl.FlatSmartphoneUuidAndGPSFixMovingJsonDeserializer;
import com.sap.sailing.server.gateway.serialization.JsonSerializer;
import com.sap.sse.common.Util.Pair;
public class RecordFixesFlatJsonPostServlet extends AbstractJsonPostServlet<Pair<UUID, GPSFixMoving>, Void> {
private static final long serialVersionUID = -4618399862031700634L;
private final JsonDeserializer<Pair<UUID, GPSFixMoving>> deserializer =
new FlatSmartphoneUuidAndGPSFixMovingJsonDeserializer();
@Override
public JsonDeserializer<Pair<UUID, GPSFixMoving>> getRequestDeserializer() {
return deserializer;
}
@Override
public JsonSerializer<Void> getResponseSerializer() {
return null;
}
@Override
public Void process(Map<String, String> parameterValues, Pair<UUID, GPSFixMoving> domainObject)
throws HttpExceptionWithMessage {
DeviceIdentifier device = new SmartphoneUUIDIdentifierImpl(domainObject.getA());
GPSFixMoving fix = domainObject.getB();
try {
getService().getGPSFixStore().storeFix(device, fix);
logger.log(Level.INFO, "Added fix for device " + device.toString() + " to store");
} catch (TransformationException | NoCorrespondingServiceRegisteredException e) {
logger.log(Level.WARNING, "Could not load store fix from device " + device);
}
return null;
}
}
@@ -1,70 +0,0 @@
package com.sap.sailing.domain.racelogtracking.servlet;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import com.sap.sailing.domain.common.racelog.tracking.NoCorrespondingServiceRegisteredException;
import com.sap.sailing.domain.common.racelog.tracking.TransformationException;
import com.sap.sailing.domain.common.racelog.tracking.TypeBasedServiceFinder;
import com.sap.sailing.domain.racelog.tracking.DeviceIdentifier;
import com.sap.sailing.domain.tracking.GPSFix;
import com.sap.sailing.server.gateway.AbstractJsonPostServlet;
import com.sap.sailing.server.gateway.HttpExceptionWithMessage;
import com.sap.sailing.server.gateway.deserialization.JsonDeserializer;
import com.sap.sailing.server.gateway.deserialization.impl.DeviceAndSessionIdentifierWithGPSFixesDeserializer;
import com.sap.sailing.server.gateway.deserialization.impl.DeviceIdentifierJsonDeserializer;
import com.sap.sailing.server.gateway.serialization.JsonSerializer;
import com.sap.sailing.server.gateway.serialization.racelog.tracking.DeviceIdentifierJsonHandler;
import com.sap.sailing.server.gateway.serialization.racelog.tracking.GPSFixJsonHandler;
import com.sap.sse.common.Util;
public class RecordFixesPostServlet extends
AbstractJsonPostServlet<Util.Triple<DeviceIdentifier, Serializable, List<GPSFix>>, Void> {
private static final long serialVersionUID = 2778739335260621119L;
private DeviceAndSessionIdentifierWithGPSFixesDeserializer deserializer;
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
TypeBasedServiceFinder<GPSFixJsonHandler> fixServiceFinder = getServiceFinderFactory().createServiceFinder(
GPSFixJsonHandler.class);
TypeBasedServiceFinder<DeviceIdentifierJsonHandler> deviceServiceFinder = getServiceFinderFactory()
.createServiceFinder(DeviceIdentifierJsonHandler.class);
deserializer = new DeviceAndSessionIdentifierWithGPSFixesDeserializer(fixServiceFinder,
new DeviceIdentifierJsonDeserializer(deviceServiceFinder));
}
@Override
public JsonDeserializer<Util.Triple<DeviceIdentifier, Serializable, List<GPSFix>>> getRequestDeserializer() {
return deserializer;
}
@Override
public JsonSerializer<Void> getResponseSerializer() {
return null;
}
@Override
public Void process(Map<String, String> parameterValues,
Util.Triple<DeviceIdentifier, Serializable, List<GPSFix>> domainObject) throws HttpExceptionWithMessage {
DeviceIdentifier device = domainObject.getA();
// might use the session id in the future
// Serializable sessionId = domainObject.getB();
List<GPSFix> fixes = domainObject.getC();
for (GPSFix fix : fixes) {
try {
getService().getGPSFixStore().storeFix(device, fix);
} catch (TransformationException | NoCorrespondingServiceRegisteredException e) {
logger.log(Level.WARNING, "Could not load store fix from device " + device);
}
}
return null;
}
}
@@ -272,9 +272,9 @@ public class SharedDomainFactoryImpl implements SharedDomainFactory {
public BoatClass getOrCreateBoatClass(String name, boolean typicallyStartsUpwind) {
synchronized (boatClassCache) {
BoatClass result = boatClassCache.get(name);
if(result == null) {
if (result == null && name != null) {
BoatClassMasterdata boatClassMasterdata = BoatClassMasterdata.resolveBoatClass(name);
if(boatClassMasterdata != null) {
if (boatClassMasterdata != null) {
result = new BoatClassImpl(name, boatClassMasterdata);
boatClassCache.put(name, result);
}
@@ -289,7 +289,7 @@ public class SharedDomainFactoryImpl implements SharedDomainFactory {
@Override
public BoatClass getOrCreateBoatClass(String name) {
return getOrCreateBoatClass(name, /* typicallyStartsUpwind */!mayStartWithNoUpwindLeg.contains(name.toLowerCase()));
return getOrCreateBoatClass(name, name == null || /* typicallyStartsUpwind */!mayStartWithNoUpwindLeg.contains(name.toLowerCase()));
}
@Override
@@ -31,7 +31,7 @@ public class DeviceMappingImpl<ItemType extends WithID> implements DeviceMapping
if (originalRaceLogEventId != null) originalRaceLogEventIds.add(originalRaceLogEventId);
}
public DeviceMappingImpl(ItemType mappedTo, DeviceIdentifier device, TimeRange timeRange, List<Serializable> originalRaceLogEventIds) {
public DeviceMappingImpl(ItemType mappedTo, DeviceIdentifier device, TimeRange timeRange, List<? extends Serializable> originalRaceLogEventIds) {
this(mappedTo, device, timeRange);
if (originalRaceLogEventIds != null) this.originalRaceLogEventIds.addAll(originalRaceLogEventIds);
}
@@ -0,0 +1,25 @@
package com.sap.sailing.domain.common;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import org.junit.Test;
import com.sap.sailing.domain.base.BoatClass;
import com.sap.sailing.domain.base.DomainFactory;
public class BoatClassWithNullNameTest {
/**
* See bug 2471
*/
@Test
public void testCreatingBoatClassWithNullName() {
DomainFactory domainFactory = DomainFactory.INSTANCE;
BoatClass boatClass = domainFactory.getOrCreateBoatClass(null);
assertNotNull(boatClass);
assertNull(boatClass.getName());
BoatClass boatClass2 = domainFactory.getOrCreateBoatClass(null);
assertSame(boatClass, boatClass2);
}
}
@@ -0,0 +1,87 @@
package com.sap.sailing.domain.common.test;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import java.util.stream.IntStream;
import org.junit.Before;
import org.junit.Test;
import org.omg.CORBA.LongHolder;
/**
* Compare Java 8 stream and function performance to direct method call performance
*
* @author Axel Uhl (D043530)
*
*/
public class Java8FunctionsPerformanceTest {
private static final Logger logger = Logger.getLogger(Java8FunctionsPerformanceTest.class.getName());
private List<Integer> intList;
private final static int SIZE = 10000000;
@Before
public void setUp() {
intList = new ArrayList<Integer>(SIZE);
for (int i=0; i<SIZE; i++) {
intList.add(i);
}
}
@Test
public void intArraySumWithIterator() {
long start = System.currentTimeMillis();
long sum = 0;
for (Integer i : intList) {
sum += i;
}
long end = System.currentTimeMillis();
assertEquals(((long) SIZE)*((long) SIZE-1l)/2, sum);
logger.info("took "+(end-start)+"ms");
}
@Test
public void intArraySumWithStream() {
long start = System.currentTimeMillis();
final LongHolder sum = new LongHolder(0);
intList.stream().forEach((i) -> sum.value += i);
long end = System.currentTimeMillis();
assertEquals(((long) SIZE)*((long) SIZE-1l)/2, sum.value);
logger.info("took "+(end-start)+"ms");
}
@Test
public void intArraySumWithForEach() {
long start = System.currentTimeMillis();
final LongHolder sum = new LongHolder(0);
intList.forEach((i) -> sum.value += i);
long end = System.currentTimeMillis();
assertEquals(((long) SIZE)*((long) SIZE-1l)/2, sum.value);
logger.info("took "+(end-start)+"ms");
}
@Test
public void intArraySumWithIntRangeStream() {
IntStream is = IntStream.range(0, SIZE);
long start = System.currentTimeMillis();
final LongHolder sum = new LongHolder(0);
is.forEach(i -> sum.value += i);
long end = System.currentTimeMillis();
assertEquals(((long) SIZE)*((long) SIZE-1l)/2, sum.value);
logger.info("took "+(end-start)+"ms");
}
@Test
public void intSum() {
long start = System.currentTimeMillis();
long sum = 0;
for (int i=0; i<SIZE; i++) {
sum += i;
}
long end = System.currentTimeMillis();
assertEquals(((long) SIZE)*((long) SIZE-1l)/2, sum);
logger.info("took "+(end-start)+"ms");
}
}
+1 -1
View File
@@ -111,7 +111,7 @@ Computes leaderboard information for sailing races and offers RESTful APIs to al
unpack="false"/>
<plugin
id="com.sap.sailing.mongodb"
id="com.sap.sse.mongodb"
download-size="0"
install-size="0"
version="0.0.0"
+1 -1
View File
@@ -19,7 +19,7 @@
<!-- -->
<!-- Any title is fine -->
<!-- -->
<title>SAP Sailing Analytics Homepage</title>
<title>SAP Sailing - Homepage</title>
<!-- -->
<!-- This script loads your compiled module. -->
+57
View File
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="com.google.gdt.eclipse.suite.webapp">
<booleanAttribute key="com.google.gdt.eclipse.core.RUN_SERVER" value="false"/>
<stringAttribute key="com.google.gdt.eclipse.suiteMainTypeProcessor.PREVIOUSLY_SET_MAIN_TYPE_NAME" value="com.google.gwt.dev.GWTShell"/>
<booleanAttribute key="com.google.gdt.eclipse.suiteWarArgumentProcessor.IS_WAR_FROM_PROJECT_PROPERTIES" value="true"/>
<stringAttribute key="com.google.gwt.eclipse.core.URL" value="/gwt/Home.html"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.sap.sailing.gwt.ui"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
</listAttribute>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6&quot; javaProject=&quot;com.sap.sailing.gwt.ui&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sailing.gwt.ui/src/main/resources&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sailing.gwt.ui/src/main/java&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sailing.domain/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.googlecode.java-diff-utils/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sailing.domain.common/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/org.json.simple/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sailing.server/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sailing.domain.tractracadapter/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sailing.expeditionconnector/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sailing.declination/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sailing.declination/resources&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sailing.udpconnector/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sse.mongodb/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sailing.domain.swisstimingadapter/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sailing.domain.persistence/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sailing.domain.swisstimingadapter.persistence/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sailing.operationaltransformation/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sailing.domain.tractracadapter.persistence/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/org.moxieapps.gwt.highcharts/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sailing.geocoding/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sailing.server.replication/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sailing.datamining.shared/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sse.common/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sse.datamining.shared/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sse.gwt/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.google.gwt.osgi/lib/gwt-user.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#13;&#10;&lt;memento exportedEntriesOnly=&quot;false&quot; project=&quot;com.sap.sailing.gwt.ui&quot;/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sse.security/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sse.security.ui/src/main/java&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.sap.sse.gwt.adminconsole/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gwt.eclipse.core.moduleClasspathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-war &quot;${project_loc:com.sap.sailing.gwt.ui}&quot; -noserver -remoteUI &quot;${gwt_remote_ui_server_port}:${unique_id}&quot; -logLevel INFO -codeServerPort 9997 -startupUrl /gwt/Home.html com.sap.sailing.gwt.Home -startupUrl /gwt/AdminConsole.html com.sap.sailing.gwt.ui.AdminConsole -startupUrl /gwt/LeaderboardEditing.html com.sap.sailing.gwt.ui.LeaderboardEditing -startupUrl /gwt/UserManagement.html com.sap.sailing.gwt.ui.UserManagement -startupUrl /gwt/Leaderboard.html com.sap.sailing.gwt.ui.Leaderboard -startupUrl /gwt/Spectator.html com.sap.sailing.gwt.ui.Spectator -startupUrl /gwt/RaceBoard.html com.sap.sailing.gwt.ui.RaceBoard -startupUrl /gwt/PolarSheets.html com.sap.sailing.gwt.ui.PolarSheets -startupUrl /gwt/RegattaOverview.html com.sap.sailing.gwt.ui.RegattaOverview -startupUrl /gwt/DataMining.html com.sap.sailing.gwt.ui.DataMining -startupUrl /gwt/Simulator.html com.sap.sailing.gwt.ui.Simulator -startupUrl /gwt/VideoPopup.html com.sap.sailing.gwt.ui.VideoPopup -startupUrl /security/ui/Login.html com.sap.sse.security.ui.Login -startupUrl /security/ui/EditProfile.html com.sap.sse.security.ui.EditProfile -startupUrl /security/ui/EmailValidation.html com.sap.sse.security.ui.EmailValidation"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.gwt.ui"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx2048m"/>
</launchConfiguration>
@@ -7,7 +7,6 @@ import java.util.Map;
import java.util.logging.Logger;
import com.google.gwt.place.shared.Place;
import com.sap.sse.gwt.client.URLEncoder;
/**
* An abstract Place which is able to manage and parse place parameters.
@@ -34,7 +33,7 @@ public abstract class AbstractBasePlace extends Place {
if(stringBuilder.length() > 0) {
stringBuilder.append("&");
}
stringBuilder.append(paramName + "=" + URLEncoder.encode(paramValue));
stringBuilder.append(paramName + "=" + paramValue);
}
}
@@ -48,7 +47,7 @@ public abstract class AbstractBasePlace extends Place {
if (url != null && !url.isEmpty()) {
this.placeParametersAsToken = url;
List<String> list = Arrays.asList(url.split("&"));
List<String> list = Arrays.asList(placeParametersAsToken.split("&"));
if (list == null || list.size() < 1) {
logger.warning("Token empty, no-op");
@@ -34,6 +34,8 @@ public interface TextMessages extends Messages {
String chooseChart();
String series();
String regattaLeaderboards();
String sapSailing();
String search();
String countdownDays();
String countdownHours();
@@ -26,6 +26,8 @@ competitorsAnalytics=Competitors Analytics
chooseChart=Choose chart type
series=Series
regattaLeaderboards=Regatta leaderboards
sapSailing=SAP Sailing
search=Search
countdownDays=Days
countdownHours=Hrs
@@ -26,6 +26,8 @@ competitorsAnalytics=Teilnehmeranalysen
chooseChart=Wähle einen Diagrammtyp aus
series=Serie
regattaLeaderboards=Regattaergebnisse
sapSailing=SAP Sailing
search=Suche
countdownDays=Tage
countdownHours=Std.
@@ -18,26 +18,25 @@ public abstract class AbstractPlaceNavigator implements PlaceNavigator {
public <T extends Place> void goToPlace(PlaceNavigation<T> placeNavigation) {
if(placeNavigation.isRemotePlace()) {
String destinationUrl = placeNavigation.getTargetUrl();
History.newItem(History.getToken());
History.newItem(History.getToken(), false);
Window.Location.replace(destinationUrl);
} else {
placeController.goTo(placeNavigation.getPlace());
placeController.goTo(placeNavigation.getPlace());
}
}
protected <T extends Place> PlaceNavigation<T> createPlaceNavigation(String baseUrl, T destinationPlace, PlaceTokenizer<T> tokenizer) {
return new PlaceNavigation<T>(baseUrl, destinationPlace, tokenizer);
protected <T extends Place> PlaceNavigation<T> createLocalPlaceNavigation(T destinationPlace, PlaceTokenizer<T> tokenizer) {
return new PlaceNavigation<T>(null, destinationPlace, tokenizer, false);
}
protected <T extends Place> PlaceNavigation<T> createGlobalPlaceNavigation(T destinationPlace, PlaceTokenizer<T> tokenizer) {
return new PlaceNavigation<T>(destinationPlace, tokenizer);
}
protected <T extends Place> PlaceNavigation<T> createPlaceNavigation(String baseUrl, boolean isOnRemoteServer, T destinationPlace, PlaceTokenizer<T> tokenizer) {
return new PlaceNavigation<T>(baseUrl, destinationPlace, tokenizer, isOnRemoteServer);
}
protected String getLocationURL() {
return Window.Location.getProtocol() + "//" + Window.Location.getHostName();
}
public <T extends Place> void pushPlaceToHistoryStack(T destinationPlace, PlaceTokenizer<T> tokenizer) {
String placeHistoryToken = destinationPlace.getClass().getSimpleName() + ":" + tokenizer.getToken(destinationPlace);
History.newItem(placeHistoryToken, false);
@@ -11,10 +11,12 @@ import com.sap.sailing.gwt.home.client.place.event.EventActivityProxy;
import com.sap.sailing.gwt.home.client.place.event.EventPlace;
import com.sap.sailing.gwt.home.client.place.events.EventsActivityProxy;
import com.sap.sailing.gwt.home.client.place.events.EventsPlace;
import com.sap.sailing.gwt.home.client.place.leaderboard.LeaderboardActivityProxy;
import com.sap.sailing.gwt.home.client.place.leaderboard.LeaderboardPlace;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaActivityProxy;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace;
import com.sap.sailing.gwt.home.client.place.searchresult.SearchResultActivityProxy;
import com.sap.sailing.gwt.home.client.place.searchresult.SearchResultPlace;
import com.sap.sailing.gwt.home.client.place.series.SeriesActivityProxy;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsActivityProxy;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace;
import com.sap.sailing.gwt.home.client.place.sponsoring.SponsoringActivityProxy;
@@ -46,8 +48,10 @@ public class ApplicationActivityMapper implements ActivityMapper {
return new SponsoringActivityProxy((SponsoringPlace) place, clientFactory);
} else if (place instanceof SolutionsPlace) {
return new SolutionsActivityProxy((SolutionsPlace) place, clientFactory);
} else if (place instanceof LeaderboardPlace) {
return new LeaderboardActivityProxy((LeaderboardPlace) place, clientFactory);
} else if (place instanceof RegattaPlace) {
return new RegattaActivityProxy((RegattaPlace) place, clientFactory);
} else if (place instanceof SeriesPlace) {
return new SeriesActivityProxy((SeriesPlace) place, clientFactory);
} else if (place instanceof SearchResultPlace) {
return new SearchResultActivityProxy((SearchResultPlace) place, clientFactory);
} else {
@@ -4,14 +4,15 @@ import com.sap.sailing.gwt.home.client.place.aboutus.AboutUsClientFactory;
import com.sap.sailing.gwt.home.client.place.contact.ContactClientFactory;
import com.sap.sailing.gwt.home.client.place.event.EventClientFactory;
import com.sap.sailing.gwt.home.client.place.events.EventsClientFactory;
import com.sap.sailing.gwt.home.client.place.leaderboard.LeaderboardClientFactory;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaClientFactory;
import com.sap.sailing.gwt.home.client.place.searchresult.SearchResultClientFactory;
import com.sap.sailing.gwt.home.client.place.series.SeriesClientFactory;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsClientFactory;
import com.sap.sailing.gwt.home.client.place.sponsoring.SponsoringClientFactory;
import com.sap.sailing.gwt.home.client.place.start.StartClientFactory;
public interface ApplicationClientFactory extends AboutUsClientFactory, ContactClientFactory, EventClientFactory,
EventsClientFactory, StartClientFactory, SponsoringClientFactory, SolutionsClientFactory, SearchResultClientFactory,
LeaderboardClientFactory {
RegattaClientFactory, SeriesClientFactory {
HomePlacesNavigator getHomePlacesNavigator();
}
@@ -6,14 +6,15 @@ import com.sap.sailing.gwt.home.client.place.aboutus.AboutUsPlace;
import com.sap.sailing.gwt.home.client.place.contact.ContactPlace;
import com.sap.sailing.gwt.home.client.place.event.EventPlace;
import com.sap.sailing.gwt.home.client.place.events.EventsPlace;
import com.sap.sailing.gwt.home.client.place.leaderboard.LeaderboardPlace;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace;
import com.sap.sailing.gwt.home.client.place.searchresult.SearchResultPlace;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace;
import com.sap.sailing.gwt.home.client.place.sponsoring.SponsoringPlace;
import com.sap.sailing.gwt.home.client.place.start.StartPlace;
@WithTokenizers({ AboutUsPlace.Tokenizer.class, ContactPlace.Tokenizer.class, EventPlace.Tokenizer.class, EventsPlace.Tokenizer.class,
SolutionsPlace.Tokenizer.class, SponsoringPlace.Tokenizer.class, SearchResultPlace.Tokenizer.class, StartPlace.Tokenizer.class,
LeaderboardPlace.Tokenizer.class})
RegattaPlace.Tokenizer.class, SeriesPlace.Tokenizer.class })
public interface ApplicationHistoryMapper extends PlaceHistoryMapper {
}
@@ -6,9 +6,13 @@ import com.sap.sailing.gwt.home.client.place.contact.ContactPlace;
import com.sap.sailing.gwt.home.client.place.event.EventPlace;
import com.sap.sailing.gwt.home.client.place.event.EventPlace.EventNavigationTabs;
import com.sap.sailing.gwt.home.client.place.events.EventsPlace;
import com.sap.sailing.gwt.home.client.place.leaderboard.LeaderboardPlace;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace.RegattaNavigationTabs;
import com.sap.sailing.gwt.home.client.place.searchresult.SearchResultPlace;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace.SeriesNavigationTabs;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace.SolutionsNavigationTabs;
import com.sap.sailing.gwt.home.client.place.sponsoring.SponsoringPlace;
import com.sap.sailing.gwt.home.client.place.start.StartPlace;
@@ -19,27 +23,27 @@ public class HomePlacesNavigator extends AbstractPlaceNavigator {
}
public PlaceNavigation<StartPlace> getHomeNavigation() {
return createPlaceNavigation(getLocationURL(), new StartPlace(), new StartPlace.Tokenizer());
return createGlobalPlaceNavigation(new StartPlace(), new StartPlace.Tokenizer());
}
public PlaceNavigation<EventsPlace> getEventsNavigation() {
return createPlaceNavigation(getLocationURL(), new EventsPlace(), new EventsPlace.Tokenizer());
return createGlobalPlaceNavigation(new EventsPlace(), new EventsPlace.Tokenizer());
}
public PlaceNavigation<SolutionsPlace> getSolutionsNavigation() {
return createPlaceNavigation(getLocationURL(), new SolutionsPlace(), new SolutionsPlace.Tokenizer());
public PlaceNavigation<SolutionsPlace> getSolutionsNavigation(SolutionsNavigationTabs navigationTab) {
return createLocalPlaceNavigation(new SolutionsPlace(navigationTab), new SolutionsPlace.Tokenizer());
}
public PlaceNavigation<SponsoringPlace> getSponsoringNavigation() {
return createPlaceNavigation(getLocationURL(), new SponsoringPlace(), new SponsoringPlace.Tokenizer());
return createGlobalPlaceNavigation(new SponsoringPlace(), new SponsoringPlace.Tokenizer());
}
public PlaceNavigation<AboutUsPlace> getAboutUsNavigation() {
return createPlaceNavigation(getLocationURL(), new AboutUsPlace(), new AboutUsPlace.Tokenizer());
return createGlobalPlaceNavigation(new AboutUsPlace(), new AboutUsPlace.Tokenizer());
}
public PlaceNavigation<ContactPlace> getContactNavigation() {
return createPlaceNavigation(getLocationURL(), new ContactPlace(), new ContactPlace.Tokenizer());
return createGlobalPlaceNavigation(new ContactPlace(), new ContactPlace.Tokenizer());
}
public PlaceNavigation<EventPlace> getEventNavigation(String eventUuidAsString, String baseUrl, boolean isOnRemoteServer) {
@@ -52,21 +56,19 @@ public class HomePlacesNavigator extends AbstractPlaceNavigator {
return createPlaceNavigation(baseUrl, isOnRemoteServer, eventPlace, new EventPlace.Tokenizer());
}
// void goToOverview();
// void goToRegattas();
// void goToSchedule();
// void goToMedia();
// void goToRegattaRaces(LeaderboardGroupDTO leaderboardGroup, StrippedLeaderboardDTO leaderboard, RaceGroupDTO raceGroup);
// void openRaceViewer(StrippedLeaderboardDTO leaderboard, RaceDTO race);
// void openOverallLeaderboardViewer(LeaderboardGroupDTO leaderboardGroup);
// void openLeaderboardViewer(LeaderboardGroupDTO leaderboardGroup, StrippedLeaderboardDTO leaderboard);
public PlaceNavigation<LeaderboardPlace> getLeaderboardNavigation(String eventUuidAsString, String leaderboardIdAsNameString, String baseUrl, boolean isOnRemoteServer) {
LeaderboardPlace leaderboardPlace = new LeaderboardPlace(eventUuidAsString, leaderboardIdAsNameString, true, true);
return createPlaceNavigation(baseUrl, isOnRemoteServer, leaderboardPlace, new LeaderboardPlace.Tokenizer());
/** this place will be merged into the common regatta view as tab later on */
public PlaceNavigation<RegattaPlace> getRegattaAnalyticsNavigation(String eventUuidAsString, RegattaNavigationTabs navigationTab, String leaderboardIdAsNameString, String baseUrl, boolean isOnRemoteServer) {
RegattaPlace regattaPlace = new RegattaPlace(eventUuidAsString, navigationTab, leaderboardIdAsNameString, true, true);
return createPlaceNavigation(baseUrl, isOnRemoteServer, regattaPlace, new RegattaPlace.Tokenizer());
}
/** this place will be merged into the common series event view as tab later on */
public PlaceNavigation<SeriesPlace> getSeriesAnalyticsNavigation(String eventUuidAsString, SeriesNavigationTabs navigationTab, String leaderboardIdAsNameString, String baseUrl, boolean isOnRemoteServer) {
SeriesPlace seriesPlace = new SeriesPlace(eventUuidAsString, navigationTab, leaderboardIdAsNameString, true, true);
return createPlaceNavigation(baseUrl, isOnRemoteServer, seriesPlace, new SeriesPlace.Tokenizer());
}
public PlaceNavigation<SearchResultPlace> getSearchResultNavigation(String searchQuery) {
return createPlaceNavigation(getLocationURL(), new SearchResultPlace(searchQuery), new SearchResultPlace.Tokenizer());
return createGlobalPlaceNavigation(new SearchResultPlace(searchQuery), new SearchResultPlace.Tokenizer());
}
}
@@ -3,6 +3,7 @@ package com.sap.sailing.gwt.home.client.app;
import com.google.gwt.core.client.GWT;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.google.gwt.user.client.Window;
public class PlaceNavigation<T extends Place> {
private final T destinationPlace;
@@ -10,18 +11,19 @@ public class PlaceNavigation<T extends Place> {
private final String baseUrl;
private final boolean isDestinationOnRemoteServer;
public PlaceNavigation(String baseUrl, T destinationPlace, PlaceTokenizer<T> tokenizer) {
public PlaceNavigation(T destinationPlace, PlaceTokenizer<T> tokenizer) {
this.destinationPlace = destinationPlace;
this.tokenizer = tokenizer;
this.baseUrl = baseUrl;
this.isDestinationOnRemoteServer = !(isLocationOnLocalhost(baseUrl) || isLocationOnDefaultSapSailingServer(baseUrl));
String locationURL = getLocationURL();
this.isDestinationOnRemoteServer = !(isLocationOnLocalhost(locationURL) || isLocationOnDefaultSapSailingServer(locationURL));
this.baseUrl = isDestinationOnRemoteServer ? AbstractPlaceNavigator.DEFAULT_SAPSAILING_SERVER_URL : locationURL;
}
public PlaceNavigation(String baseUrl, T destinationPlace, PlaceTokenizer<T> tokenizer, boolean isDestinationOnRemoteServer) {
this.destinationPlace = destinationPlace;
this.tokenizer = tokenizer;
this.baseUrl = baseUrl;
this.isDestinationOnRemoteServer = isDestinationOnRemoteServer;
this.baseUrl = isDestinationOnRemoteServer ? baseUrl : getLocationURL();
}
public void gotoPlace() {
@@ -31,23 +33,40 @@ public class PlaceNavigation<T extends Place> {
return buildPlaceUrl();
}
public String getHistoryUrl() {
String placeUrl = buildPlaceUrl();
if(placeUrl.startsWith("#")) {
placeUrl = placeUrl.substring(1, placeUrl.length());
}
return placeUrl;
}
public Place getPlace() {
return destinationPlace;
}
private String buildPlaceUrl() {
String url = baseUrl + "/gwt/Home.html";
if(!GWT.isProdMode() && !isDestinationOnRemoteServer) {
url += "?gwt.codesvr=127.0.0.1:9997";
String url = "";
if(isRemotePlace()) {
url = baseUrl + "/gwt/Home.html";
if(!GWT.isProdMode()) {
url += "?gwt.codesvr=127.0.0.1:9997";
}
url += getPlaceToken();
} else {
url = getPlaceToken();
}
url += "#" + destinationPlace.getClass().getSimpleName() + ":" + tokenizer.getToken(destinationPlace);
return url;
}
public boolean isRemotePlace() {
return isDestinationOnRemoteServer;
}
private String getPlaceToken() {
return "#" + destinationPlace.getClass().getSimpleName() + ":" + tokenizer.getToken(destinationPlace);
}
private boolean isLocationOnDefaultSapSailingServer(String urlToCheck) {
return urlToCheck.contains(HomePlacesNavigator.DEFAULT_SAPSAILING_SERVER);
}
@@ -55,4 +74,8 @@ public class PlaceNavigation<T extends Place> {
private boolean isLocationOnLocalhost(String urlToCheck) {
return urlToCheck.contains("localhost") || urlToCheck.contains("127.0.0.1");
}
private String getLocationURL() {
return Window.Location.getProtocol() + "//" + Window.Location.getHostName() + ":" + Window.Location.getPort();
}
}
@@ -6,22 +6,24 @@ import com.google.gwt.event.shared.SimpleEventBus;
import com.google.gwt.place.shared.PlaceController;
import com.google.web.bindery.event.shared.EventBus;
import com.sap.sailing.gwt.home.client.place.error.TabletAndDesktopErrorView;
import com.sap.sailing.gwt.home.client.place.event.EventPlace.EventNavigationTabs;
import com.sap.sailing.gwt.home.client.place.event.EventView;
import com.sap.sailing.gwt.home.client.place.event.EventWithoutRegattasView;
import com.sap.sailing.gwt.home.client.place.event.TabletAndDesktopEventView;
import com.sap.sailing.gwt.home.client.place.event.TabletAndDesktopEventWithoutRegattasView;
import com.sap.sailing.gwt.home.client.place.event.EventPlace.EventNavigationTabs;
import com.sap.sailing.gwt.home.client.place.events.EventsActivity;
import com.sap.sailing.gwt.home.client.place.events.EventsView;
import com.sap.sailing.gwt.home.client.place.events.TabletAndDesktopEventsView;
import com.sap.sailing.gwt.home.client.place.leaderboard.AnalyticsView;
import com.sap.sailing.gwt.home.client.place.leaderboard.TabletAndDesktopLeaderboardView;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaAnalyticsView;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace.RegattaNavigationTabs;
import com.sap.sailing.gwt.home.client.place.regatta.TabletAndDesktopRegattaView;
import com.sap.sailing.gwt.home.client.place.searchresult.SearchResultView;
import com.sap.sailing.gwt.home.client.place.searchresult.TabletAndDesktopSearchResultView;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsActivity;
import com.sap.sailing.gwt.home.client.place.series.SeriesAnalyticsView;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace.SeriesNavigationTabs;
import com.sap.sailing.gwt.home.client.place.series.TabletAndDesktopSeriesView;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace.SolutionsNavigationTabs;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsView;
import com.sap.sailing.gwt.home.client.place.solutions.TabletAndDesktopSolutionsView;
import com.sap.sailing.gwt.home.client.place.sponsoring.SponsoringActivity;
import com.sap.sailing.gwt.home.client.place.sponsoring.SponsoringView;
import com.sap.sailing.gwt.home.client.place.sponsoring.TabletAndDesktopSponsoringView;
import com.sap.sailing.gwt.home.client.place.start.StartView;
@@ -51,11 +53,11 @@ public class SmartphoneApplicationClientFactory extends AbstractApplicationClien
@Override
public EventWithoutRegattasView createEventWithoutRegattasView(EventDTO event) {
return new TabletAndDesktopEventWithoutRegattasView(getSailingService(), event);
return new TabletAndDesktopEventWithoutRegattasView(getSailingService(), event, getHomePlacesNavigator());
}
@Override
public EventsView createEventsView(EventsActivity activity) {
public EventsView createEventsView() {
return new TabletAndDesktopEventsView(getHomePlacesNavigator());
}
@@ -70,18 +72,23 @@ public class SmartphoneApplicationClientFactory extends AbstractApplicationClien
}
@Override
public SponsoringView createSponsoringView(SponsoringActivity activity) {
public SponsoringView createSponsoringView() {
return new TabletAndDesktopSponsoringView();
}
@Override
public SolutionsView createSolutionsView(SolutionsActivity activity) {
return new TabletAndDesktopSolutionsView();
public SolutionsView createSolutionsView(SolutionsNavigationTabs navigationTab) {
return new TabletAndDesktopSolutionsView(navigationTab, getHomePlacesNavigator());
}
@Override
public AnalyticsView createLeaderboardView(EventDTO event, String leaderboardName, Timer timerForClientServerOffset) {
return new TabletAndDesktopLeaderboardView(event, leaderboardName, timerForClientServerOffset, getHomePlacesNavigator());
public RegattaAnalyticsView createRegattaAnalyticsView(EventDTO event, String leaderboardName, RegattaNavigationTabs navigationTab, Timer timerForClientServerOffset) {
return new TabletAndDesktopRegattaView(event, leaderboardName, navigationTab, timerForClientServerOffset, getHomePlacesNavigator());
}
@Override
public SeriesAnalyticsView createSeriesAnalyticsView(EventDTO event, String leaderboardName, SeriesNavigationTabs navigationTab, Timer timerForClientServerOffset) {
return new TabletAndDesktopSeriesView(event, leaderboardName, navigationTab, timerForClientServerOffset, getHomePlacesNavigator());
}
@Override
@@ -6,22 +6,24 @@ import com.google.gwt.event.shared.SimpleEventBus;
import com.google.gwt.place.shared.PlaceController;
import com.google.web.bindery.event.shared.EventBus;
import com.sap.sailing.gwt.home.client.place.error.TabletAndDesktopErrorView;
import com.sap.sailing.gwt.home.client.place.event.EventPlace.EventNavigationTabs;
import com.sap.sailing.gwt.home.client.place.event.EventView;
import com.sap.sailing.gwt.home.client.place.event.EventWithoutRegattasView;
import com.sap.sailing.gwt.home.client.place.event.TabletAndDesktopEventView;
import com.sap.sailing.gwt.home.client.place.event.TabletAndDesktopEventWithoutRegattasView;
import com.sap.sailing.gwt.home.client.place.event.EventPlace.EventNavigationTabs;
import com.sap.sailing.gwt.home.client.place.events.EventsActivity;
import com.sap.sailing.gwt.home.client.place.events.EventsView;
import com.sap.sailing.gwt.home.client.place.events.TabletAndDesktopEventsView;
import com.sap.sailing.gwt.home.client.place.leaderboard.AnalyticsView;
import com.sap.sailing.gwt.home.client.place.leaderboard.TabletAndDesktopLeaderboardView;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaAnalyticsView;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace.RegattaNavigationTabs;
import com.sap.sailing.gwt.home.client.place.regatta.TabletAndDesktopRegattaView;
import com.sap.sailing.gwt.home.client.place.searchresult.SearchResultView;
import com.sap.sailing.gwt.home.client.place.searchresult.TabletAndDesktopSearchResultView;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsActivity;
import com.sap.sailing.gwt.home.client.place.series.SeriesAnalyticsView;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace.SeriesNavigationTabs;
import com.sap.sailing.gwt.home.client.place.series.TabletAndDesktopSeriesView;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace.SolutionsNavigationTabs;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsView;
import com.sap.sailing.gwt.home.client.place.solutions.TabletAndDesktopSolutionsView;
import com.sap.sailing.gwt.home.client.place.sponsoring.SponsoringActivity;
import com.sap.sailing.gwt.home.client.place.sponsoring.SponsoringView;
import com.sap.sailing.gwt.home.client.place.sponsoring.TabletAndDesktopSponsoringView;
import com.sap.sailing.gwt.home.client.place.start.StartView;
@@ -56,11 +58,11 @@ public class TabletAndDesktopApplicationClientFactory extends AbstractApplicatio
@Override
public EventWithoutRegattasView createEventWithoutRegattasView(EventDTO event) {
return new TabletAndDesktopEventWithoutRegattasView(getSailingService(), event);
return new TabletAndDesktopEventWithoutRegattasView(getSailingService(), event, getHomePlacesNavigator());
}
@Override
public EventsView createEventsView(EventsActivity activity) {
public EventsView createEventsView() {
return new TabletAndDesktopEventsView(getHomePlacesNavigator());
}
@@ -70,18 +72,23 @@ public class TabletAndDesktopApplicationClientFactory extends AbstractApplicatio
}
@Override
public SponsoringView createSponsoringView(SponsoringActivity activity) {
public SponsoringView createSponsoringView() {
return new TabletAndDesktopSponsoringView();
}
@Override
public SolutionsView createSolutionsView(SolutionsActivity activity) {
return new TabletAndDesktopSolutionsView();
public SolutionsView createSolutionsView(SolutionsNavigationTabs navigationTab) {
return new TabletAndDesktopSolutionsView(navigationTab, getHomePlacesNavigator());
}
@Override
public AnalyticsView createLeaderboardView(EventDTO event, String leaderboardName, Timer timerForClientServerOffset) {
return new TabletAndDesktopLeaderboardView(event, leaderboardName, timerForClientServerOffset, getHomePlacesNavigator());
public RegattaAnalyticsView createRegattaAnalyticsView(EventDTO event, String leaderboardName, RegattaNavigationTabs navigationTab, Timer timerForClientServerOffset) {
return new TabletAndDesktopRegattaView(event, leaderboardName, navigationTab, timerForClientServerOffset, getHomePlacesNavigator());
}
@Override
public SeriesAnalyticsView createSeriesAnalyticsView(EventDTO event, String leaderboardName, SeriesNavigationTabs navigationTab, Timer timerForClientServerOffset) {
return new TabletAndDesktopSeriesView(event, leaderboardName, navigationTab, timerForClientServerOffset, getHomePlacesNavigator());
}
@Override
@@ -56,7 +56,7 @@ public class EventActivity extends AbstractActivity {
clientFactory.getSailingService().getEventById(eventUUID, true, new AsyncCallback<EventDTO>() {
@Override
public void onSuccess(final EventDTO event) {
loadRegattaStructure(panel, clientTimeWhenRequestWasSent, event);
loadRegattaStructureAndCreateEventView(panel, clientTimeWhenRequestWasSent, event);
}
@Override
@@ -66,8 +66,9 @@ public class EventActivity extends AbstractActivity {
});
}
private void loadRegattaStructure(final AcceptsOneWidget panel, final long clientTimeWhenRequestWasSent, final EventDTO event) {
private void loadRegattaStructureAndCreateEventView(final AcceptsOneWidget panel, final long clientTimeWhenRequestWasSent, final EventDTO event) {
this.event = event;
if(event.getLeaderboardGroups().size() > 0) {
clientFactory.getSailingService().getRegattaStructureOfEvent(event.id, new AsyncCallback<List<RaceGroupDTO>>() {
@Override
@@ -115,12 +116,14 @@ public class EventActivity extends AbstractActivity {
private void createEventView(EventDTO event, List<RaceGroupDTO> raceGroups, AcceptsOneWidget panel) {
view = clientFactory.createEventView(event, eventPlace.getNavigationTab(), raceGroups, eventPlace.getLeaderboardIdAsNameString(), timerForClientServerOffset);
panel.setWidget(view.asWidget());
Window.setTitle(eventPlace.getTitle(event.getName()));
}
private void createEventWithoutRegattasView(EventDTO event, AcceptsOneWidget panel) {
// no leaderboard groups defined yet -> show a teaser page
EventWithoutRegattasView view = clientFactory.createEventWithoutRegattasView(event);
panel.setWidget(view.asWidget());
Window.setTitle(eventPlace.getTitle(event.getName()));
}
protected void loadAndUpdateEventRaceStatesLog() {
@@ -2,6 +2,7 @@ package com.sap.sailing.gwt.home.client.place.event;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.sap.sailing.gwt.common.client.AbstractBasePlace;
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
public class EventPlace extends AbstractBasePlace {
private final String eventUuidAsString;
@@ -33,6 +34,10 @@ public class EventPlace extends AbstractBasePlace {
this.leaderboardIdAsNameString = leaderboardIdAsNameString;
}
public String getTitle(String eventName) {
return TextMessages.INSTANCE.sapSailing() + " - " + eventName;
}
public String getEventUuidAsString() {
return eventUuidAsString;
}
@@ -11,7 +11,7 @@ public interface EventPlaceNavigator {
void goToSchedule();
void goToMedia();
void goToRegattaRaces(LeaderboardGroupDTO leaderboardGroup, StrippedLeaderboardDTO leaderboard, RaceGroupDTO raceGroup);
void openRaceViewer(StrippedLeaderboardDTO leaderboard, RaceDTO race);
String getRaceViewerURL(StrippedLeaderboardDTO leaderboard, RaceDTO race);
void openOverallLeaderboardViewer(LeaderboardGroupDTO leaderboardGroup);
void openLeaderboardViewer(LeaderboardGroupDTO leaderboardGroup, StrippedLeaderboardDTO leaderboard);
}
@@ -141,11 +141,9 @@ public class TabletAndDesktopEventView extends Composite implements EventView, E
currentInternalPlace = new EventPlace(event.id.toString(), EventNavigationTabs.Media, null);
}
@Override
public void openRaceViewer(StrippedLeaderboardDTO leaderboard, RaceDTO race) {
public String getRaceViewerURL(StrippedLeaderboardDTO leaderboard, RaceDTO race) {
RegattaAndRaceIdentifier raceIdentifier = race.getRaceIdentifier();
String link = EntryPointLinkFactory.createRaceBoardLink(createRaceBoardLinkParameters(leaderboard.name, raceIdentifier));
Window.open(link, "_blank", "");
return EntryPointLinkFactory.createRaceBoardLink(createRaceBoardLinkParameters(leaderboard.name, raceIdentifier));
}
@Override
@@ -5,6 +5,7 @@ import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.place.event.header.EventHeader;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.shared.EventDTO;
@@ -17,8 +18,8 @@ public class TabletAndDesktopEventWithoutRegattasView extends Composite implemen
@UiField(provided=true) EventHeader eventHeader;
public TabletAndDesktopEventWithoutRegattasView(SailingServiceAsync sailingService, EventDTO event) {
eventHeader = new EventHeader(event);
public TabletAndDesktopEventWithoutRegattasView(SailingServiceAsync sailingService, EventDTO event, HomePlacesNavigator placeNavigator) {
eventHeader = new EventHeader(event, placeNavigator);
initWidget(uiBinder.createAndBindUi(this));
}
@@ -10,8 +10,10 @@ import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
import com.sap.sailing.domain.common.LeaderboardNameConstants;
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
@@ -19,7 +21,8 @@ import com.sap.sailing.gwt.home.client.app.PlaceNavigation;
import com.sap.sailing.gwt.home.client.place.event.AbstractEventComposite;
import com.sap.sailing.gwt.home.client.place.event.EventPlace;
import com.sap.sailing.gwt.home.client.place.event.EventPlaceNavigator;
import com.sap.sailing.gwt.home.client.place.leaderboard.LeaderboardPlace;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace.SeriesNavigationTabs;
import com.sap.sailing.gwt.home.client.shared.EventDatesFormatterUtil;
import com.sap.sailing.gwt.ui.shared.CourseAreaDTO;
import com.sap.sailing.gwt.ui.shared.EventDTO;
@@ -32,6 +35,8 @@ public class EventHeader extends AbstractEventComposite {
interface EventHeaderUiBinder extends UiBinder<Widget, EventHeader> {
}
private static final HyperlinkImpl HYPERLINK_IMPL = GWT.create(HyperlinkImpl.class);
// @UiField Anchor overviewLink;
@UiField Anchor regattasLink;
// @UiField Anchor scheduleLink;
@@ -72,8 +77,9 @@ public class EventHeader extends AbstractEventComposite {
// private final List<Anchor> links3;
private final HomePlacesNavigator placeNavigator;
private PlaceNavigation<LeaderboardPlace> overallLeaderboardNavigation = null;
private PlaceNavigation<SeriesPlace> seriesAnalyticsNavigation = null;
private PlaceNavigation<EventPlace> regattasNavigation = null;
public EventHeader(EventDTO event, HomePlacesNavigator placeNavigator, EventPlaceNavigator pageNavigator) {
super(event, pageNavigator);
@@ -100,10 +106,10 @@ public class EventHeader extends AbstractEventComposite {
updateUI();
}
public EventHeader(EventDTO event) {
public EventHeader(EventDTO event, HomePlacesNavigator placeNavigator) {
super(event, null);
this.placeNavigator = null;
this.placeNavigator = placeNavigator;
initResources();
isFinishedDiv.getStyle().setDisplay(Display.NONE);
@@ -128,9 +134,9 @@ public class EventHeader extends AbstractEventComposite {
eventHeaderWrapperDiv.setAttribute("data-navigationtype", "compact");
EventDTO event = getEvent();
PlaceNavigation<EventPlace> eventNavigation = placeNavigator.getEventNavigation(event.id.toString(), event.getBaseURL(), event.isOnRemoteServer());
regattasLink.setHref(eventNavigation.getTargetUrl());
regattasLink2.setHref(eventNavigation.getTargetUrl());
PlaceNavigation<EventPlace> regattaDetailsNavigation = placeNavigator.getEventNavigation(event.id.toString(), event.getBaseURL(), event.isOnRemoteServer());
regattasLink.setHref(regattaDetailsNavigation.getTargetUrl());
regattasLink2.setHref(regattaDetailsNavigation.getTargetUrl());
}
private StrippedLeaderboardDTO findLeaderboardWithSameCourseArea(EventDTO event) {
@@ -151,13 +157,15 @@ public class EventHeader extends AbstractEventComposite {
boolean isSeries = event.isFakeSeries();
String eventName = event.getName();
regattasNavigation = placeNavigator.getEventNavigation(event.id.toString(), event.getBaseURL(), event.isOnRemoteServer());
if(isSeries) {
LeaderboardGroupDTO leaderboardGroupDTO = event.getLeaderboardGroups().get(0);
eventName = leaderboardGroupDTO.getDisplayName() != null ? leaderboardGroupDTO.getDisplayName() : leaderboardGroupDTO.getName();
String overallLeaderboardName = leaderboardGroupDTO.getName() + " " + LeaderboardNameConstants.OVERALL;
overallLeaderboardNavigation = placeNavigator.getLeaderboardNavigation(event.id.toString(), overallLeaderboardName, event.getBaseURL(), event.isOnRemoteServer());
seriesLeaderboardAnchor.setHref(overallLeaderboardNavigation.getTargetUrl());
seriesAnalyticsNavigation = placeNavigator.getSeriesAnalyticsNavigation(event.id.toString(), SeriesNavigationTabs.OverallLeaderboard, overallLeaderboardName, event.getBaseURL(), event.isOnRemoteServer());
seriesLeaderboardAnchor.setHref(seriesAnalyticsNavigation.getTargetUrl());
StrippedLeaderboardDTO leaderboardFittingToEvent = findLeaderboardWithSameCourseArea(event);
if(leaderboardFittingToEvent != null) {
@@ -242,10 +250,10 @@ public class EventHeader extends AbstractEventComposite {
}
@UiHandler("seriesLeaderboardAnchor")
void seriesLeaderboardClicked(ClickEvent clickevent) {
void seriesLeaderboardClicked(ClickEvent e) {
EventDTO event = getEvent();
if(event.isFakeSeries() && overallLeaderboardNavigation != null) {
placeNavigator.goToPlace(overallLeaderboardNavigation);
if(event.isFakeSeries()) {
handleClickEvent(e, seriesAnalyticsNavigation);
}
}
@@ -254,10 +262,8 @@ public class EventHeader extends AbstractEventComposite {
// showRegattas();
// }
//
private void showRegattas(ClickEvent clickevent) {
getPageNavigator().goToRegattas();
clickevent.preventDefault();
private void showRegattas(ClickEvent e) {
handleClickEvent(e, regattasNavigation);
// setActiveLink(links1, regattasLink);
// setActiveLink(links2, regattasLink2);
// setActiveLink(links3, regattasLink3);
@@ -306,6 +312,13 @@ public class EventHeader extends AbstractEventComposite {
// setActiveLink(links2, mediaLink2);
// setActiveLink(links3, mediaLink3);
// }
private void handleClickEvent(ClickEvent e, PlaceNavigation<?> placeNavigation) {
if (HYPERLINK_IMPL.handleAsClick((Event) e.getNativeEvent())) {
placeNavigator.goToPlace(placeNavigation);
e.preventDefault();
}
}
@Override
protected void onLoad() {
@@ -1,7 +1,6 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:s="urn:import:com.sap.sailing.gwt.home.client.place.event"
xmlns:p="urn:import:com.sap.sailing.gwt.home.client.place.leaderboard"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:with field="i18n" type="com.sap.sailing.gwt.common.client.i18n.TextMessages"/>
<ui:with field="res" type="com.sap.sailing.gwt.common.client.SharedResources" />
@@ -1,7 +1,6 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:s="urn:import:com.sap.sailing.gwt.home.client.place.event"
xmlns:p="urn:import:com.sap.sailing.gwt.home.client.place.leaderboard"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:with field="i18n" type="com.sap.sailing.gwt.common.client.i18n.TextMessages"/>
<ui:with field="res" type="com.sap.sailing.gwt.common.client.SharedResources" />
@@ -1,7 +1,6 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:s="urn:import:com.sap.sailing.gwt.home.client.place.event"
xmlns:p="urn:import:com.sap.sailing.gwt.home.client.place.leaderboard"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:with field="i18n" type="com.sap.sailing.gwt.common.client.i18n.TextMessages"/>
<ui:with field="res" type="com.sap.sailing.gwt.common.client.SharedResources" />
@@ -13,17 +13,20 @@ import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
import com.sap.sailing.gwt.common.client.BoatClassImageResolver;
import com.sap.sailing.gwt.common.client.BoatClassImageResources;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.app.PlaceNavigation;
import com.sap.sailing.gwt.home.client.place.event.EventPlace;
import com.sap.sailing.gwt.home.client.place.event.EventPlaceNavigator;
import com.sap.sailing.gwt.home.client.place.leaderboard.LeaderboardPlace;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace.RegattaNavigationTabs;
import com.sap.sailing.gwt.home.client.shared.LongNamesUtil;
import com.sap.sailing.gwt.ui.shared.EventDTO;
import com.sap.sailing.gwt.ui.shared.LeaderboardGroupDTO;
@@ -38,6 +41,8 @@ public class Regatta extends Composite {
interface RegattaUiBinder extends UiBinder<Widget, Regatta> {
}
private static final HyperlinkImpl HYPERLINK_IMPL = GWT.create(HyperlinkImpl.class);
private final EventDTO event;
private final Timer timerForClientServerOffset;
private RaceGroupDTO raceGroup;
@@ -73,7 +78,7 @@ public class Regatta extends Composite {
@UiField Image boatClassImage;
private PlaceNavigation<LeaderboardPlace> leaderboardNavigation;
private PlaceNavigation<RegattaPlace> leaderboardNavigation;
private PlaceNavigation<EventPlace> regattaNavigation;
private final HomePlacesNavigator placesNavigator;
private final EventPlaceNavigator eventPlaceNavigator;
@@ -104,7 +109,8 @@ public class Regatta extends Composite {
if(isSingleView) {
regattaDetailsLink.setVisible(false);
leaderboardNavigation = placesNavigator.getLeaderboardNavigation(event.id.toString(), leaderboard.name, event.getBaseURL(), event.isOnRemoteServer());
leaderboardNavigation = placesNavigator.getRegattaAnalyticsNavigation(event.id.toString(), RegattaNavigationTabs.Leaderboard,
leaderboard.name, event.getBaseURL(), event.isOnRemoteServer());
leaderboardLink.setHref(leaderboardNavigation.getTargetUrl());
} else {
leaderboardLink.setVisible(false);
@@ -165,13 +171,18 @@ public class Regatta extends Composite {
@UiHandler("regattaDetailsLink")
void regattaDetailsLinkClicked(ClickEvent e) {
placesNavigator.goToPlace(regattaNavigation);
e.preventDefault();
handleClickEvent(e, regattaNavigation);
}
@UiHandler("leaderboardLink")
void leaderboardLinkClicked(ClickEvent e) {
placesNavigator.goToPlace(leaderboardNavigation);
e.preventDefault();
handleClickEvent(e, leaderboardNavigation);
}
private void handleClickEvent(ClickEvent e, PlaceNavigation<?> placeNavigation) {
if (HYPERLINK_IMPL.handleAsClick((Event) e.getNativeEvent())) {
placesNavigator.goToPlace(placeNavigation);
e.preventDefault();
}
}
}
@@ -11,10 +11,13 @@ import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
import com.sap.sailing.domain.common.DetailType;
import com.sap.sailing.domain.common.RaceIdentifier;
import com.sap.sailing.domain.common.dto.FleetDTO;
@@ -22,10 +25,13 @@ import com.sap.sailing.domain.common.dto.LeaderboardDTO;
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
import com.sap.sailing.gwt.common.client.SharedResources;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.app.PlaceNavigation;
import com.sap.sailing.gwt.home.client.place.event.header.CompactEventHeader;
import com.sap.sailing.gwt.home.client.place.event.oldcompetitorcharts.OldCompetitorCharts;
import com.sap.sailing.gwt.home.client.place.event.oldleaderboard.OldLeaderboard;
import com.sap.sailing.gwt.home.client.place.event.regattaleaderboard.EventRegattaLeaderboardResources;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace.RegattaNavigationTabs;
import com.sap.sailing.gwt.ui.client.LeaderboardUpdateListener;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
@@ -43,6 +49,8 @@ public class RegattaAnalytics extends Composite implements LeaderboardUpdateList
interface RegattaAnalyticsUiBinder extends UiBinder<Widget, RegattaAnalytics> {
}
private static final HyperlinkImpl HYPERLINK_IMPL = GWT.create(HyperlinkImpl.class);
@UiField OldLeaderboard oldLeaderboardComposite;
@UiField OldCompetitorCharts oldCompetitorChartsComposite;
@UiField(provided=true) CompactEventHeader eventHeader;
@@ -57,12 +65,18 @@ public class RegattaAnalytics extends Composite implements LeaderboardUpdateList
@UiField Anchor leaderboardAnchor;
@UiField Anchor competitorChartsAnchor;
private final PlaceNavigation<RegattaPlace> leaderboardNavigation;
private final PlaceNavigation<RegattaPlace> competitorChartsNavigation;
private RegattaAnalyticsDataManager regattaAnalyticsManager;
private Timer autoRefreshTimer;
private RegattaNavigationTabs navigationTab;
public RegattaAnalytics(EventDTO event, String leaderboardName, Timer timerForClientServerOffset, HomePlacesNavigator placeNavigator) {
eventHeader = new CompactEventHeader(event, leaderboardName, placeNavigator);
public RegattaAnalytics(EventDTO event, String leaderboardName, RegattaNavigationTabs navigationTab, Timer timerForClientServerOffset, HomePlacesNavigator placesNavigator) {
this.navigationTab = navigationTab;
eventHeader = new CompactEventHeader(event, leaderboardName, placesNavigator);
EventRegattaLeaderboardResources.INSTANCE.css().ensureInjected();
RegattaAnalyticsResources.INSTANCE.css().ensureInjected();
@@ -71,13 +85,17 @@ public class RegattaAnalytics extends Composite implements LeaderboardUpdateList
title.setInnerText(leaderboardName);
activeAnchor = leaderboardAnchor;
activeTabPanel = leaderboardTabPanel;
activeAnchor.addStyleName(SharedResources.INSTANCE.mainCss().navbar_buttonactive());
competitorChartsTabPanel.setVisible(false);
leaderboardTabPanel.setVisible(false);
liveRaceDiv.getStyle().setVisibility(Visibility.HIDDEN);
leaderboardNavigation = placesNavigator.getRegattaAnalyticsNavigation(event.id.toString(), RegattaNavigationTabs.Leaderboard, leaderboardName,
event.getBaseURL(), event.isOnRemoteServer());
competitorChartsNavigation = placesNavigator.getRegattaAnalyticsNavigation(event.id.toString(), RegattaNavigationTabs.CompetitorAnalytics, leaderboardName,
event.getBaseURL(), event.isOnRemoteServer());
leaderboardAnchor.setHref(leaderboardNavigation.getTargetUrl());
competitorChartsAnchor.setHref(competitorChartsNavigation.getTargetUrl());
}
public void createRegattaAnalyticsViewer(final SailingServiceAsync sailingService, final AsyncActionsExecutor asyncActionsExecutor,
@@ -101,6 +119,17 @@ public class RegattaAnalytics extends Composite implements LeaderboardUpdateList
oldCompetitorChartsComposite.setChart(regattaAnalyticsManager.getMultiCompetitorChart(), availableDetailsTypes, initialDetailType);
regattaAnalyticsManager.hideCompetitorChart();
switch(navigationTab) {
case Leaderboard:
setActiveTabPanel(leaderboardTabPanel, leaderboardAnchor);
break;
case CompetitorAnalytics:
setActiveTabPanel(competitorChartsTabPanel, competitorChartsAnchor);
DetailType selectedChartDetailType = oldCompetitorChartsComposite.getSelectedChartDetailType();
regattaAnalyticsManager.showCompetitorChart(selectedChartDetailType);
break;
}
}
@Override
@@ -144,6 +173,7 @@ public class RegattaAnalytics extends Composite implements LeaderboardUpdateList
void leaderboardTabClicked(ClickEvent event) {
setActiveTabPanel(leaderboardTabPanel, leaderboardAnchor);
regattaAnalyticsManager.hideCompetitorChart();
handleClickEvent(event, leaderboardNavigation);
}
@UiHandler("competitorChartsAnchor")
@@ -151,6 +181,7 @@ public class RegattaAnalytics extends Composite implements LeaderboardUpdateList
setActiveTabPanel(competitorChartsTabPanel, competitorChartsAnchor);
DetailType selectedChartDetailType = oldCompetitorChartsComposite.getSelectedChartDetailType();
regattaAnalyticsManager.showCompetitorChart(selectedChartDetailType);
handleClickEvent(event, competitorChartsNavigation);
}
private void setActiveTabPanel(HTMLPanel newActivePanel, Anchor newActiveAnchor) {
@@ -164,4 +195,13 @@ public class RegattaAnalytics extends Composite implements LeaderboardUpdateList
activeTabPanel.setVisible(true);
activeAnchor.addStyleName(SharedResources.INSTANCE.mainCss().navbar_buttonactive());
}
private void handleClickEvent(ClickEvent e, PlaceNavigation<?> placeNavigation) {
if (HYPERLINK_IMPL.handleAsClick((Event) e.getNativeEvent())) {
// don't use the placecontroller for navigation here as we want to avoid a page reload
History.newItem(placeNavigation.getHistoryUrl(), false);
e.preventDefault();
}
}
}
@@ -1,7 +1,7 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:s="urn:import:com.sap.sailing.gwt.home.client.place.event"
xmlns:p="urn:import:com.sap.sailing.gwt.home.client.place.leaderboard"
xmlns:p="urn:import:com.sap.sailing.gwt.home.client.place.regatta"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:with field="i18n" type="com.sap.sailing.gwt.common.client.i18n.TextMessages"/>
<ui:with field="res" type="com.sap.sailing.gwt.common.client.SharedResources" />
@@ -20,8 +20,8 @@
</div>
</div>
<div class="{res.mediaCss.small12} {res.mediaCss.columns} {local_res.css.regattaleaderboard_meta_navigation}">
<g:Anchor ui:field="leaderboardAnchor" href="javascript:;" styleName="{res.mainCss.navbar_button}"><ui:text from="{i18n.leaderboard}" /></g:Anchor>
<g:Anchor ui:field="competitorChartsAnchor" href="javascript:;" styleName="{res.mainCss.navbar_button}"><ui:text from="{i18n.competitorsAnalytics}" /></g:Anchor>
<g:Anchor ui:field="leaderboardAnchor" styleName="{res.mainCss.navbar_button}"><ui:text from="{i18n.leaderboard}" /></g:Anchor>
<g:Anchor ui:field="competitorChartsAnchor" styleName="{res.mainCss.navbar_button}"><ui:text from="{i18n.competitorsAnalytics}" /></g:Anchor>
</div>
</div>
<g:HTMLPanel ui:field="leaderboardTabPanel">
@@ -1,7 +1,6 @@
package com.sap.sailing.gwt.home.client.place.event.regattaraces;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.AnchorElement;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.SpanElement;
@@ -10,10 +9,9 @@ import com.google.gwt.dom.client.Style.Visibility;
import com.google.gwt.i18n.shared.DateTimeFormat;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.EventListener;
import com.google.gwt.user.client.ui.UIObject;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.domain.common.dto.CompetitorDTO;
import com.sap.sailing.domain.common.dto.FleetDTO;
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
@@ -22,12 +20,12 @@ import com.sap.sailing.gwt.home.client.place.event.EventPlaceNavigator;
import com.sap.sailing.gwt.ui.shared.StrippedLeaderboardDTO;
import com.sap.sse.gwt.client.player.Timer;
public class EventRegattaRacesRace extends UIObject {
public class EventRegattaRacesRace extends Composite {
private static EventRegattaRacesRaceUiBinder uiBinder = GWT.create(EventRegattaRacesRaceUiBinder.class);
private enum SimpleRaceStates { NOT_TRACKED, TRACKED, TRACKED_AND_LIVE, TRACKED_BUT_NOT_SCHEDULED };
interface EventRegattaRacesRaceUiBinder extends UiBinder<DivElement, EventRegattaRacesRace> {
interface EventRegattaRacesRaceUiBinder extends UiBinder<Widget, EventRegattaRacesRace> {
}
@UiField DivElement fleetColor;
@@ -41,8 +39,8 @@ public class EventRegattaRacesRace extends UIObject {
@UiField DivElement raceNotScheduledDiv;
@UiField DivElement watchRaceDiv;
@UiField DivElement analyzeRaceDiv;
@UiField AnchorElement watchRaceLink;
@UiField AnchorElement analyzeRaceLink;
@UiField Anchor watchRaceLink;
@UiField Anchor analyzeRaceLink;
@UiField DivElement raceWinnerDiv;
@UiField SpanElement raceWinner;
@@ -64,25 +62,21 @@ public class EventRegattaRacesRace extends UIObject {
private final DateTimeFormat raceTimeFormat = DateTimeFormat.getFormat("EEE, h:mm a");
private final StrippedLeaderboardDTO leaderboard;
private final FleetDTO fleet;
private final RaceColumnDTO raceColumn;
private final RaceDTO race;
private final EventPlaceNavigator pageNavigator;
private final Timer timerForClientServerOffset;
private Element[] allConditionalElements;
public EventRegattaRacesRace(StrippedLeaderboardDTO leaderboard, FleetDTO fleet, RaceColumnDTO raceColumn, Timer timerForClientServerOffset, EventPlaceNavigator pageNavigator) {
this.leaderboard = leaderboard;
this.fleet = fleet;
this.raceColumn = raceColumn;
this.pageNavigator = pageNavigator;
this.timerForClientServerOffset = timerForClientServerOffset;
race = raceColumn.getRace(fleet);
EventRegattaRacesResources.INSTANCE.css().ensureInjected();
setElement(uiBinder.createAndBindUi(this));
initWidget(uiBinder.createAndBindUi(this));
allConditionalElements = new Element[] {raceWinnerDiv, raceLeaderDiv, watchRaceDiv, analyzeRaceDiv, raceNotTrackedDiv, raceNotScheduledDiv,
raceFeaturesDiv, legProgressDiv, raceFlagDiv, windStatusDiv };
@@ -94,35 +88,14 @@ public class EventRegattaRacesRace extends UIObject {
raceName.setInnerText(raceColumn.getName());
raceName2.setInnerText(raceColumn.getName());
registerEvents();
if(race != null && race.trackedRace != null) {
String raceViewerURL = pageNavigator.getRaceViewerURL(leaderboard, race);
analyzeRaceLink.setHref(raceViewerURL);
watchRaceLink.setHref(raceViewerURL);
}
updateUI();
}
private void registerEvents() {
Event.sinkEvents(analyzeRaceLink, Event.ONCLICK);
Event.setEventListener(analyzeRaceLink, new EventListener() {
@Override
public void onBrowserEvent(Event event) {
switch (DOM.eventGetType(event)) {
case Event.ONCLICK:
openRaceViewer();
break;
}
}
});
Event.sinkEvents(watchRaceLink, Event.ONCLICK);
Event.setEventListener(watchRaceLink, new EventListener() {
@Override
public void onBrowserEvent(Event event) {
switch (DOM.eventGetType(event)) {
case Event.ONCLICK:
openRaceViewer();
break;
}
}
});
}
private SimpleRaceStates getSimpleRaceState() {
SimpleRaceStates simpleRaceState = SimpleRaceStates.NOT_TRACKED;
@@ -227,10 +200,4 @@ public class EventRegattaRacesRace extends UIObject {
el.getStyle().setVisibility(Visibility.VISIBLE);
el.getStyle().setDisplay(Display.INLINE_BLOCK);
}
private void openRaceViewer() {
if(race != null && race.trackedRace != null) {
pageNavigator.openRaceViewer(leaderboard, race);
}
}
}
@@ -5,7 +5,7 @@
<ui:with field="i18n" type="com.sap.sailing.gwt.common.client.i18n.TextMessages"/>
<ui:with field="res" type="com.sap.sailing.gwt.common.client.SharedResources" />
<ui:with field="local_res" type="com.sap.sailing.gwt.home.client.place.event.regattaraces.EventRegattaRacesResources" />
<div class="{local_res.css.eventregattarace}">
<g:HTMLPanel styleName="{local_res.css.eventregattarace}">
<div ui:field="fleetColor" class="{local_res.css.eventregattarace_fleetindicator}"></div>
<!-- race name -->
<div class="{local_res.css.eventregattarace_details} {local_res.css.eventregattarace_name}">
@@ -45,11 +45,11 @@
<ui:text from='{i18n.raceNotScheduled}'/>
</div>
<div ui:field="watchRaceDiv" class="{local_res.css.eventregattarace_action}">
<a ui:field="watchRaceLink" class="{res.mainCss.button} {local_res.css.eventregattarace_action_watch}"><ui:text from='{i18n.eventRegattaRaceWatch}'/></a>
<g:Anchor ui:field="watchRaceLink" target="_blank" styleName="{res.mainCss.button} {local_res.css.eventregattarace_action_watch}"><ui:text from='{i18n.eventRegattaRaceWatch}'/></g:Anchor>
</div>
<div ui:field="analyzeRaceDiv" class="{local_res.css.eventregattarace_action}">
<a ui:field="analyzeRaceLink" class="{res.mainCss.button} {local_res.css.eventregattarace_action_analyze}"><ui:text from='{i18n.eventRegattaRaceAnalyse}'/></a>
<g:Anchor ui:field="analyzeRaceLink" target="_blank" styleName="{res.mainCss.button} {local_res.css.eventregattarace_action_analyze}"><ui:text from='{i18n.eventRegattaRaceAnalyse}'/></g:Anchor>
</div>
</div>
</g:HTMLPanel>
</ui:UiBinder>
@@ -11,10 +11,13 @@ import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
import com.sap.sailing.domain.common.DetailType;
import com.sap.sailing.domain.common.LeaderboardNameConstants;
import com.sap.sailing.domain.common.RaceIdentifier;
@@ -23,11 +26,14 @@ import com.sap.sailing.domain.common.dto.LeaderboardDTO;
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
import com.sap.sailing.gwt.common.client.SharedResources;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.app.PlaceNavigation;
import com.sap.sailing.gwt.home.client.place.event.header.CompactEventHeader;
import com.sap.sailing.gwt.home.client.place.event.oldcompetitorcharts.OldCompetitorCharts;
import com.sap.sailing.gwt.home.client.place.event.oldleaderboard.OldLeaderboard;
import com.sap.sailing.gwt.home.client.place.event.oldmultileaderboard.OldMultiLeaderboard;
import com.sap.sailing.gwt.home.client.place.event.regattaleaderboard.EventRegattaLeaderboardResources;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace.SeriesNavigationTabs;
import com.sap.sailing.gwt.ui.client.LeaderboardUpdateListener;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
@@ -45,6 +51,8 @@ public class EventSeriesAnalytics extends Composite implements LeaderboardUpdate
interface EventSeriesAnalyticsUiBinder extends UiBinder<Widget, EventSeriesAnalytics> {
}
private static final HyperlinkImpl HYPERLINK_IMPL = GWT.create(HyperlinkImpl.class);
@UiField OldLeaderboard oldOverallLeaderboardComposite;
@UiField OldCompetitorCharts oldCompetitorChartsComposite;
@UiField OldMultiLeaderboard oldRegattaLeaderboardsComposite;
@@ -56,19 +64,25 @@ public class EventSeriesAnalytics extends Composite implements LeaderboardUpdate
@UiField HTMLPanel overallLeaderboardTabPanel;
@UiField HTMLPanel regattaLeaderboardsTabPanel;
@UiField HTMLPanel competitorChartsTabPanel;
private HTMLPanel activeTabPanel;
private Widget activeContentWidget;
private Anchor activeAnchor;
@UiField Anchor overallLeaderboardAnchor;
@UiField Anchor regattaLeaderboardsAnchor;
@UiField Anchor competitorChartsAnchor;
private final PlaceNavigation<SeriesPlace> overallLeaderboardNavigation;
private final PlaceNavigation<SeriesPlace> regattaLeaderboardsNavigation;
private final PlaceNavigation<SeriesPlace> competitorChartsNavigation;
private HTMLPanel activeTabPanel;
private Widget activeContentWidget;
private Anchor activeAnchor;
private EventSeriesAnalyticsDataManager eventSeriesAnalyticsManager;
private Timer autoRefreshTimer;
private SeriesNavigationTabs navigationTab;
public EventSeriesAnalytics(EventDTO event, String leaderboardName, Timer timerForClientServerOffset, HomePlacesNavigator placeNavigator) {
eventHeader = new CompactEventHeader(event, leaderboardName, placeNavigator);
public EventSeriesAnalytics(EventDTO event, String leaderboardName, SeriesNavigationTabs navigationTab, Timer timerForClientServerOffset, HomePlacesNavigator placesNavigator) {
this.navigationTab = navigationTab;
eventHeader = new CompactEventHeader(event, leaderboardName, placesNavigator);
EventRegattaLeaderboardResources.INSTANCE.css().ensureInjected();
EventSeriesAnalyticsResources.INSTANCE.css().ensureInjected();
@@ -82,14 +96,21 @@ public class EventSeriesAnalytics extends Composite implements LeaderboardUpdate
}
title.setInnerText(seriesTitle);
activeAnchor = overallLeaderboardAnchor;
activeTabPanel = overallLeaderboardTabPanel;
activeContentWidget = null;
activeAnchor.addStyleName(SharedResources.INSTANCE.mainCss().navbar_buttonactive());
overallLeaderboardTabPanel.setVisible(false);
regattaLeaderboardsTabPanel.setVisible(false);
competitorChartsTabPanel.setVisible(false);
liveRaceDiv.getStyle().setVisibility(Visibility.HIDDEN);
overallLeaderboardNavigation = placesNavigator.getSeriesAnalyticsNavigation(event.id.toString(), SeriesNavigationTabs.OverallLeaderboard, leaderboardName,
event.getBaseURL(), event.isOnRemoteServer());
regattaLeaderboardsNavigation = placesNavigator.getSeriesAnalyticsNavigation(event.id.toString(), SeriesNavigationTabs.RegattaLeaderboards, leaderboardName,
event.getBaseURL(), event.isOnRemoteServer());
competitorChartsNavigation = placesNavigator.getSeriesAnalyticsNavigation(event.id.toString(), SeriesNavigationTabs.CompetitorAnalytics, leaderboardName,
event.getBaseURL(), event.isOnRemoteServer());
overallLeaderboardAnchor.setHref(overallLeaderboardNavigation.getTargetUrl());
regattaLeaderboardsAnchor.setHref(regattaLeaderboardsNavigation.getTargetUrl());
competitorChartsAnchor.setHref(competitorChartsNavigation.getTargetUrl());
}
public void createSeriesAnalyticsViewer(SailingServiceAsync sailingService, AsyncActionsExecutor asyncActionsExecutor,
@@ -117,7 +138,21 @@ public class EventSeriesAnalytics extends Composite implements LeaderboardUpdate
eventSeriesAnalyticsManager.getLeaderboardPanel().addLeaderboardUpdateListener(this);
eventSeriesAnalyticsManager.getMultiLeaderboardPanel().addLeaderboardUpdateListener(this);
switch(navigationTab) {
case OverallLeaderboard:
setActiveTabPanel(overallLeaderboardTabPanel, eventSeriesAnalyticsManager.getLeaderboardPanel(), overallLeaderboardAnchor);
break;
case RegattaLeaderboards:
setActiveTabPanel(regattaLeaderboardsTabPanel, eventSeriesAnalyticsManager.getMultiLeaderboardPanel(), regattaLeaderboardsAnchor);
break;
case CompetitorAnalytics:
setActiveTabPanel(competitorChartsTabPanel, eventSeriesAnalyticsManager.getMultiCompetitorChart(), competitorChartsAnchor);
DetailType selectedChartDetailType = oldCompetitorChartsComposite.getSelectedChartDetailType();
eventSeriesAnalyticsManager.showCompetitorChart(selectedChartDetailType);
break;
}
activeContentWidget = eventSeriesAnalyticsManager.getLeaderboardPanel();
}
@@ -163,11 +198,13 @@ public class EventSeriesAnalytics extends Composite implements LeaderboardUpdate
@UiHandler("overallLeaderboardAnchor")
void overallLeaderboardTabClicked(ClickEvent event) {
setActiveTabPanel(overallLeaderboardTabPanel, eventSeriesAnalyticsManager.getLeaderboardPanel(), overallLeaderboardAnchor);
handleClickEvent(event, overallLeaderboardNavigation);
}
@UiHandler("regattaLeaderboardsAnchor")
void regattaLeaderboardsTabClicked(ClickEvent event) {
setActiveTabPanel(regattaLeaderboardsTabPanel, eventSeriesAnalyticsManager.getMultiLeaderboardPanel(), regattaLeaderboardsAnchor);
handleClickEvent(event, regattaLeaderboardsNavigation);
}
@UiHandler("competitorChartsAnchor")
@@ -175,6 +212,7 @@ public class EventSeriesAnalytics extends Composite implements LeaderboardUpdate
setActiveTabPanel(competitorChartsTabPanel, eventSeriesAnalyticsManager.getMultiCompetitorChart(), competitorChartsAnchor);
DetailType selectedChartDetailType = oldCompetitorChartsComposite.getSelectedChartDetailType();
eventSeriesAnalyticsManager.showCompetitorChart(selectedChartDetailType);
handleClickEvent(event, competitorChartsNavigation);
}
private void setActiveTabPanel(HTMLPanel newActivePanel, Widget newActiveContentWidget, Anchor newActiveAnchor) {
@@ -193,4 +231,12 @@ public class EventSeriesAnalytics extends Composite implements LeaderboardUpdate
activeContentWidget.setVisible(true);
activeAnchor.addStyleName(SharedResources.INSTANCE.mainCss().navbar_buttonactive());
}
private void handleClickEvent(ClickEvent e, PlaceNavigation<?> placeNavigation) {
if (HYPERLINK_IMPL.handleAsClick((Event) e.getNativeEvent())) {
// don't use the placecontroller for navigation here as we want to avoid a page reload
History.newItem(placeNavigation.getHistoryUrl(), false);
e.preventDefault();
}
}
}
@@ -1,7 +1,7 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:s="urn:import:com.sap.sailing.gwt.home.client.place.event"
xmlns:p="urn:import:com.sap.sailing.gwt.home.client.place.leaderboard"
xmlns:p="urn:import:com.sap.sailing.gwt.home.client.place.series"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:with field="i18n" type="com.sap.sailing.gwt.common.client.i18n.TextMessages"/>
<ui:with field="res" type="com.sap.sailing.gwt.common.client.SharedResources" />
@@ -20,9 +20,9 @@
</div>
</div>
<div class="{res.mediaCss.small12} {res.mediaCss.columns} {local_res.css.regattaleaderboard_meta_navigation}">
<g:Anchor ui:field="overallLeaderboardAnchor" href="javascript:;" styleName="{res.mainCss.navbar_button}"><ui:text from="{i18n.overallLeaderboard}" /></g:Anchor>
<g:Anchor ui:field="regattaLeaderboardsAnchor" href="javascript:;" styleName="{res.mainCss.navbar_button}"><ui:text from="{i18n.regattaLeaderboards}" /></g:Anchor>
<g:Anchor ui:field="competitorChartsAnchor" href="javascript:;" styleName="{res.mainCss.navbar_button}"><ui:text from="{i18n.competitorsAnalytics}" /></g:Anchor>
<g:Anchor ui:field="overallLeaderboardAnchor" styleName="{res.mainCss.navbar_button}"><ui:text from="{i18n.overallLeaderboard}" /></g:Anchor>
<g:Anchor ui:field="regattaLeaderboardsAnchor" styleName="{res.mainCss.navbar_button}"><ui:text from="{i18n.regattaLeaderboards}" /></g:Anchor>
<g:Anchor ui:field="competitorChartsAnchor" styleName="{res.mainCss.navbar_button}"><ui:text from="{i18n.competitorsAnalytics}" /></g:Anchor>
</div>
</div>
<g:HTMLPanel ui:field="overallLeaderboardTabPanel">
@@ -4,6 +4,7 @@ import java.util.List;
import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.sap.sailing.gwt.home.client.shared.placeholder.Placeholder;
@@ -13,9 +14,11 @@ import com.sap.sse.gwt.client.mvp.ErrorView;
public class EventsActivity extends AbstractActivity {
private final EventsClientFactory clientFactory;
private final EventsPlace place;
public EventsActivity(EventsPlace place, EventsClientFactory clientFactory) {
this.clientFactory = clientFactory;
this.place = place;
}
@Override
@@ -25,8 +28,9 @@ public class EventsActivity extends AbstractActivity {
clientFactory.getSailingService().getPublicEventsOfAllSailingServers(new AsyncCallback<List<EventBaseDTO>>() {
@Override
public void onSuccess(List<EventBaseDTO> events) {
final EventsView eventsView = clientFactory.createEventsView(EventsActivity.this);
final EventsView eventsView = clientFactory.createEventsView();
panel.setWidget(eventsView.asWidget());
Window.setTitle(place.getTitle());
eventsView.setEvents(events);
}
@@ -3,5 +3,5 @@ package com.sap.sailing.gwt.home.client.place.events;
import com.sap.sailing.gwt.ui.client.SailingClientFactory;
public interface EventsClientFactory extends SailingClientFactory {
EventsView createEventsView(EventsActivity activity);
EventsView createEventsView();
}
@@ -2,8 +2,13 @@ package com.sap.sailing.gwt.home.client.place.events;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
public class EventsPlace extends Place {
public String getTitle() {
return TextMessages.INSTANCE.sapSailing() + " - " + TextMessages.INSTANCE.events();
}
public static class Tokenizer implements PlaceTokenizer<EventsPlace> {
@Override
public String getToken(EventsPlace place) {
@@ -1,25 +0,0 @@
package com.sap.sailing.gwt.home.client.place.leaderboard;
import com.google.gwt.core.client.GWT;
import com.sap.sse.gwt.client.mvp.AbstractActivityProxy;
public class LeaderboardActivityProxy extends AbstractActivityProxy {
private final LeaderboardClientFactory clientFactory;
private final LeaderboardPlace place;
public LeaderboardActivityProxy(LeaderboardPlace place, LeaderboardClientFactory clientFactory) {
this.place = place;
this.clientFactory = clientFactory;
}
@Override
protected void startAsync() {
GWT.runAsync(new AbstractRunAsyncCallback() {
@Override
public void onSuccess() {
super.onSuccess(new LeaderboardActivity(place, clientFactory));
}
});
}
}
@@ -1,9 +0,0 @@
package com.sap.sailing.gwt.home.client.place.leaderboard;
import com.sap.sailing.gwt.ui.client.SailingClientFactory;
import com.sap.sailing.gwt.ui.shared.EventDTO;
import com.sap.sse.gwt.client.player.Timer;
public interface LeaderboardClientFactory extends SailingClientFactory {
AnalyticsView createLeaderboardView(EventDTO event, String leaderboardName, Timer timerForClientServerOffset);
}
@@ -1,4 +1,4 @@
package com.sap.sailing.gwt.home.client.place.leaderboard;
package com.sap.sailing.gwt.home.client.place.regatta;
import java.util.ArrayList;
import java.util.Collections;
@@ -33,16 +33,16 @@ import com.sap.sse.gwt.client.player.Timer.PlayStates;
import com.sap.sse.gwt.client.useragent.UserAgentDetails;
import com.sap.sse.gwt.shared.GwtHttpRequestUtils;
public class LeaderboardActivity extends AbstractActivity implements ErrorReporter {
private final LeaderboardClientFactory clientFactory;
private final LeaderboardPlace leaderboardPlace;
public class RegattaActivity extends AbstractActivity implements ErrorReporter {
private final RegattaClientFactory clientFactory;
private final RegattaPlace regattaPlace;
private final Timer timerForClientServerOffset;
private final UserAgentDetails userAgent = new UserAgentDetails(Window.Navigator.getUserAgent());
public LeaderboardActivity(LeaderboardPlace place, LeaderboardClientFactory clientFactory) {
public RegattaActivity(RegattaPlace place, RegattaClientFactory clientFactory) {
this.clientFactory = clientFactory;
this.leaderboardPlace = place;
this.regattaPlace = place;
timerForClientServerOffset = new Timer(PlayModes.Replay);
}
@@ -51,9 +51,9 @@ public class LeaderboardActivity extends AbstractActivity implements ErrorReport
public void start(final AcceptsOneWidget panel, EventBus eventBus) {
panel.setWidget(new Placeholder());
UUID eventUUID = UUID.fromString(leaderboardPlace.getEventUuidAsString());
final String leaderboardName = leaderboardPlace.getLeaderboardIdAsNameString();
final boolean showRaceDetails = leaderboardPlace.getShowRaceDetails();
UUID eventUUID = UUID.fromString(regattaPlace.getEventUuidAsString());
final String leaderboardName = regattaPlace.getLeaderboardIdAsNameString();
final boolean showRaceDetails = regattaPlace.getShowRaceDetails();
clientFactory.getSailingService().getEventById(eventUUID, true, new AsyncCallback<EventDTO>() {
@Override
@@ -63,8 +63,12 @@ public class LeaderboardActivity extends AbstractActivity implements ErrorReport
new AsyncCallback<Util.Pair<String, LeaderboardType>>() {
@Override
public void onSuccess(Util.Pair<String, LeaderboardType> leaderboardNameAndType) {
if (leaderboardNameAndType != null && leaderboardName.equals(leaderboardNameAndType.getA())) {
createAnalyticsViewer(panel, event, leaderboardNameAndType.getA(), leaderboardNameAndType.getB(), showRaceDetails);
if(leaderboardNameAndType != null && leaderboardName.equals(leaderboardNameAndType.getA())) {
if(leaderboardNameAndType.getB().isMetaLeaderboard()) {
createErrorView("Leaderboard is a meta leaderboard.", null, panel);
} else {
createAnalyticsViewer(panel, event, leaderboardNameAndType.getA(), leaderboardNameAndType.getB(), showRaceDetails);
}
} else {
createErrorView(TextMessages.INSTANCE.errorMessageNoSuchLeaderboard(), null, panel);
}
@@ -103,19 +107,13 @@ public class LeaderboardActivity extends AbstractActivity implements ErrorReport
} // interval has been specified
boolean autoExpandLastRaceColumn = GwtHttpRequestUtils.getBooleanParameter(LeaderboardUrlSettings.PARAM_AUTO_EXPAND_LAST_RACE_COLUMN, false);
boolean showOverallLeaderboard = GwtHttpRequestUtils.getBooleanParameter(LeaderboardUrlSettings.PARAM_SHOW_OVERALL_LEADERBOARD, false);
boolean showSeriesLeaderboards = GwtHttpRequestUtils.getBooleanParameter(LeaderboardUrlSettings.PARAM_SHOW_SERIES_LEADERBOARDS, false);
AnalyticsView analyticsView = clientFactory.createLeaderboardView(event, leaderboardName, timerForClientServerOffset);
RegattaAnalyticsView analyticsView = clientFactory.createRegattaAnalyticsView(event, leaderboardName, regattaPlace.getNavigationTab(), timerForClientServerOffset);
Window.setTitle(regattaPlace.getTitle(event.getName(), leaderboardDisplayName));
if (leaderboardType.isMetaLeaderboard()) {
analyticsView.createSeriesAnalyticsViewer(clientFactory.getSailingService(), new AsyncActionsExecutor(),
timer, leaderboardSettings, null, preselectedRace, "leaderboardGroupName", leaderboardName, this,
userAgent, showRaceDetails, autoExpandLastRaceColumn, showSeriesLeaderboards);
} else {
analyticsView.createRegattaAnalyticsViewer(clientFactory.getSailingService(), new AsyncActionsExecutor(),
timer, leaderboardSettings, preselectedRace, "leaderboardGroupName", leaderboardName, this,
userAgent, showRaceDetails, autoExpandLastRaceColumn, showOverallLeaderboard);
}
analyticsView.createRegattaAnalyticsViewer(clientFactory.getSailingService(), new AsyncActionsExecutor(),
timer, leaderboardSettings, preselectedRace, "leaderboardGroupName", leaderboardName, this,
userAgent, showRaceDetails, autoExpandLastRaceColumn, showOverallLeaderboard);
panel.setWidget(analyticsView.asWidget());
}
@@ -0,0 +1,25 @@
package com.sap.sailing.gwt.home.client.place.regatta;
import com.google.gwt.core.client.GWT;
import com.sap.sse.gwt.client.mvp.AbstractActivityProxy;
public class RegattaActivityProxy extends AbstractActivityProxy {
private final RegattaClientFactory clientFactory;
private final RegattaPlace place;
public RegattaActivityProxy(RegattaPlace place, RegattaClientFactory clientFactory) {
this.place = place;
this.clientFactory = clientFactory;
}
@Override
protected void startAsync() {
GWT.runAsync(new AbstractRunAsyncCallback() {
@Override
public void onSuccess() {
super.onSuccess(new RegattaActivity(place, clientFactory));
}
});
}
}
@@ -1,4 +1,4 @@
package com.sap.sailing.gwt.home.client.place.leaderboard;
package com.sap.sailing.gwt.home.client.place.regatta;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.domain.common.RaceIdentifier;
@@ -9,7 +9,7 @@ import com.sap.sse.gwt.client.async.AsyncActionsExecutor;
import com.sap.sse.gwt.client.player.Timer;
import com.sap.sse.gwt.client.useragent.UserAgentDetails;
public interface AnalyticsView {
public interface RegattaAnalyticsView {
Widget asWidget();
void createRegattaAnalyticsViewer(final SailingServiceAsync sailingService, final AsyncActionsExecutor asyncActionsExecutor,
@@ -17,10 +17,4 @@ public interface AnalyticsView {
final String leaderboardGroupName, String leaderboardName, final ErrorReporter errorReporter,
final UserAgentDetails userAgent, boolean showRaceDetails,
boolean autoExpandLastRaceColumn, boolean showOverallLeaderboard);
void createSeriesAnalyticsViewer(SailingServiceAsync sailingService, AsyncActionsExecutor asyncActionsExecutor,
Timer timer, LeaderboardSettings leaderboardSettings, String preselectedLeaderboardName, RaceIdentifier preselectedRace,
String leaderboardGroupName, String metaLeaderboardName, ErrorReporter errorReporter,
UserAgentDetails userAgent, boolean showRaceDetails,
boolean autoExpandLastRaceColumn, boolean showSeriesLeaderboards);
}
@@ -0,0 +1,10 @@
package com.sap.sailing.gwt.home.client.place.regatta;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace.RegattaNavigationTabs;
import com.sap.sailing.gwt.ui.client.SailingClientFactory;
import com.sap.sailing.gwt.ui.shared.EventDTO;
import com.sap.sse.gwt.client.player.Timer;
public interface RegattaClientFactory extends SailingClientFactory {
RegattaAnalyticsView createRegattaAnalyticsView(EventDTO event, String leaderboardName, RegattaNavigationTabs navigationTab, Timer timerForClientServerOffset);
}
@@ -1,40 +1,60 @@
package com.sap.sailing.gwt.home.client.place.leaderboard;
package com.sap.sailing.gwt.home.client.place.regatta;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.sap.sailing.gwt.common.client.AbstractBasePlace;
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
public class LeaderboardPlace extends AbstractBasePlace {
public class RegattaPlace extends AbstractBasePlace {
private final String eventUuidAsString;
private final String leaderboardIdAsNameString;
private final Boolean showRaceDetails;
private final Boolean showSettings;
private final RegattaNavigationTabs navigationTab;
private final static String PARAM_EVENTID = "eventId";
private final static String PARAM_LEADERBOARD_NAME = "leaderboardName";
private final static String PARAM_SHOW_RACE_DETAILS = "showRaceDetails";
private final static String PARAM_SHOW_SETTINGS = "showSettings";
private final static String PARAM_NAVIGATION_TAB = "navigationTab";
public enum RegattaNavigationTabs { Leaderboard, CompetitorAnalytics };
public LeaderboardPlace(String url) {
public RegattaPlace(String url) {
super(url);
eventUuidAsString = getParameter(PARAM_EVENTID);
leaderboardIdAsNameString = getParameter(PARAM_LEADERBOARD_NAME);
showRaceDetails = Boolean.valueOf(getParameter(PARAM_SHOW_RACE_DETAILS));
showSettings = Boolean.valueOf(getParameter(PARAM_SHOW_SETTINGS));
String paramNavTab = getParameter(PARAM_NAVIGATION_TAB);
if(paramNavTab != null) {
navigationTab = RegattaNavigationTabs.valueOf(paramNavTab);
} else {
navigationTab = RegattaNavigationTabs.Leaderboard;
}
}
public LeaderboardPlace(String eventUuidAsString, String leaderboardIdAsNameString, Boolean showRaceDetails, Boolean showSettings) {
super(PARAM_EVENTID, eventUuidAsString, PARAM_LEADERBOARD_NAME, leaderboardIdAsNameString,
public RegattaPlace(String eventUuidAsString, RegattaNavigationTabs navigationTab, String leaderboardIdAsNameString, Boolean showRaceDetails, Boolean showSettings) {
super(PARAM_EVENTID, eventUuidAsString, PARAM_NAVIGATION_TAB, navigationTab.name(), PARAM_LEADERBOARD_NAME, leaderboardIdAsNameString,
PARAM_SHOW_RACE_DETAILS, String.valueOf(showRaceDetails), PARAM_SHOW_SETTINGS, String.valueOf(showSettings));
this.eventUuidAsString = eventUuidAsString;
this.navigationTab = navigationTab;
this.leaderboardIdAsNameString = leaderboardIdAsNameString;
this.showRaceDetails = showRaceDetails;
this.showSettings = showSettings;
}
public String getTitle(String eventName, String leaderboardName) {
return TextMessages.INSTANCE.sapSailing() + " - " + TextMessages.INSTANCE.leaderboard() + ": " + leaderboardName;
}
public String getEventUuidAsString() {
return eventUuidAsString;
}
public RegattaNavigationTabs getNavigationTab() {
return navigationTab;
}
public String getLeaderboardIdAsNameString() {
return leaderboardIdAsNameString;
}
@@ -47,15 +67,15 @@ public class LeaderboardPlace extends AbstractBasePlace {
return showSettings;
}
public static class Tokenizer implements PlaceTokenizer<LeaderboardPlace> {
public static class Tokenizer implements PlaceTokenizer<RegattaPlace> {
@Override
public String getToken(LeaderboardPlace place) {
public String getToken(RegattaPlace place) {
return place.getParametersAsToken();
}
@Override
public LeaderboardPlace getPlace(String url) {
return new LeaderboardPlace(url);
public RegattaPlace getPlace(String url) {
return new RegattaPlace(url);
}
}
}
@@ -0,0 +1,45 @@
package com.sap.sailing.gwt.home.client.place.regatta;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.domain.common.RaceIdentifier;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.place.event.regattaanalytics.RegattaAnalytics;
import com.sap.sailing.gwt.home.client.place.regatta.RegattaPlace.RegattaNavigationTabs;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardSettings;
import com.sap.sailing.gwt.ui.shared.EventDTO;
import com.sap.sse.gwt.client.ErrorReporter;
import com.sap.sse.gwt.client.async.AsyncActionsExecutor;
import com.sap.sse.gwt.client.player.Timer;
import com.sap.sse.gwt.client.useragent.UserAgentDetails;
public class TabletAndDesktopRegattaView extends Composite implements RegattaAnalyticsView {
private static TabletAndDesktopRegattaViewUiBinder uiBinder = GWT.create(TabletAndDesktopRegattaViewUiBinder.class);
interface TabletAndDesktopRegattaViewUiBinder extends UiBinder<Widget, TabletAndDesktopRegattaView> {
}
@UiField(provided=true) RegattaAnalytics regattaAnalytics;
public TabletAndDesktopRegattaView(EventDTO event, String leaderboardName, RegattaNavigationTabs navigationTab, Timer timerForClientServerOffset, HomePlacesNavigator placeNavigator) {
regattaAnalytics = new RegattaAnalytics(event, leaderboardName, navigationTab, timerForClientServerOffset, placeNavigator);
initWidget(uiBinder.createAndBindUi(this));
regattaAnalytics.setVisible(false);
}
public void createRegattaAnalyticsViewer(final SailingServiceAsync sailingService, final AsyncActionsExecutor asyncActionsExecutor,
final Timer timer, final LeaderboardSettings leaderboardSettings, final RaceIdentifier preselectedRace,
final String leaderboardGroupName, String leaderboardName, final ErrorReporter errorReporter,
final UserAgentDetails userAgent, boolean showRaceDetails,
boolean autoExpandLastRaceColumn, boolean showOverallLeaderboard) {
regattaAnalytics.createRegattaAnalyticsViewer(sailingService, asyncActionsExecutor, timer, leaderboardSettings, preselectedRace,
leaderboardGroupName, leaderboardName, errorReporter, userAgent, showRaceDetails, autoExpandLastRaceColumn, showOverallLeaderboard);
regattaAnalytics.setVisible(true);
}
}
@@ -0,0 +1,10 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:s="urn:import:com.sap.sailing.gwt.home.client.place.event"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:with field="i18n" type="com.sap.sailing.gwt.common.client.i18n.TextMessages" />
<ui:with field="res" type="com.sap.sailing.gwt.common.client.SharedResources" />
<g:HTMLPanel>
<s:regattaanalytics.RegattaAnalytics ui:field='regattaAnalytics'/>
</g:HTMLPanel>
</ui:UiBinder>
@@ -42,6 +42,8 @@ public class SearchResultActivity extends AbstractActivity {
view = clientFactory.createSearchResultView();
panel.setWidget(view.asWidget());
Window.setTitle(searchResultPlace.getTitle());
doSearch(searchResultPlace.getSearchText());
}
@@ -2,6 +2,7 @@ package com.sap.sailing.gwt.home.client.place.searchresult;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
public class SearchResultPlace extends Place {
private final String searchText;
@@ -11,6 +12,10 @@ public class SearchResultPlace extends Place {
this.searchText = searchText;
}
public String getTitle() {
return TextMessages.INSTANCE.sapSailing() + " - " + TextMessages.INSTANCE.search();
}
public String getSearchText() {
return searchText;
}
@@ -0,0 +1,237 @@
package com.sap.sailing.gwt.home.client.place.series;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.sap.sailing.domain.common.DetailType;
import com.sap.sailing.domain.common.LeaderboardType;
import com.sap.sailing.domain.common.RaceIdentifier;
import com.sap.sailing.domain.common.RegattaNameAndRaceName;
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
import com.sap.sailing.gwt.home.client.shared.placeholder.Placeholder;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardSettings;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardSettings.RaceColumnSelectionStrategies;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardSettingsFactory;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardUrlSettings;
import com.sap.sailing.gwt.ui.shared.EventDTO;
import com.sap.sse.common.Util;
import com.sap.sse.gwt.client.ErrorReporter;
import com.sap.sse.gwt.client.async.AsyncActionsExecutor;
import com.sap.sse.gwt.client.async.MarkedAsyncCallback;
import com.sap.sse.gwt.client.mvp.ErrorView;
import com.sap.sse.gwt.client.player.Timer;
import com.sap.sse.gwt.client.player.Timer.PlayModes;
import com.sap.sse.gwt.client.player.Timer.PlayStates;
import com.sap.sse.gwt.client.useragent.UserAgentDetails;
import com.sap.sse.gwt.shared.GwtHttpRequestUtils;
public class SeriesActivity extends AbstractActivity implements ErrorReporter {
private final SeriesClientFactory clientFactory;
private final SeriesPlace seriesPlace;
private final Timer timerForClientServerOffset;
private final UserAgentDetails userAgent = new UserAgentDetails(Window.Navigator.getUserAgent());
public SeriesActivity(SeriesPlace place, SeriesClientFactory clientFactory) {
this.clientFactory = clientFactory;
this.seriesPlace = place;
timerForClientServerOffset = new Timer(PlayModes.Replay);
}
@Override
public void start(final AcceptsOneWidget panel, EventBus eventBus) {
panel.setWidget(new Placeholder());
UUID eventUUID = UUID.fromString(seriesPlace.getEventUuidAsString());
final String leaderboardName = seriesPlace.getLeaderboardIdAsNameString();
final boolean showRaceDetails = seriesPlace.getShowRaceDetails();
clientFactory.getSailingService().getEventById(eventUUID, true, new AsyncCallback<EventDTO>() {
@Override
public void onSuccess(final EventDTO event) {
if (leaderboardName != null) {
clientFactory.getSailingService().checkLeaderboardName(leaderboardName, new MarkedAsyncCallback<Util.Pair<String, LeaderboardType>>(
new AsyncCallback<Util.Pair<String, LeaderboardType>>() {
@Override
public void onSuccess(Util.Pair<String, LeaderboardType> leaderboardNameAndType) {
if(leaderboardNameAndType != null && leaderboardName.equals(leaderboardNameAndType.getA())) {
if(!leaderboardNameAndType.getB().isMetaLeaderboard()) {
createErrorView("Leaderboard is a not meta leaderboard.", null, panel);
} else {
createAnalyticsViewer(panel, event, leaderboardNameAndType.getA(), leaderboardNameAndType.getB(), showRaceDetails);
}
} else {
createErrorView(TextMessages.INSTANCE.errorMessageNoSuchLeaderboard(), null, panel);
}
}
@Override
public void onFailure(Throwable caught) {
createErrorView("Error while checking the leaderboard name with service checkLeaderboardName()", caught, panel);
}
}));
} else {
createErrorView(TextMessages.INSTANCE.errorMessageNoSuchLeaderboard(), null, panel);
}
}
@Override
public void onFailure(Throwable caught) {
createErrorView("Error while loading the event with service getEventById()", caught, panel);
}
});
}
private void createAnalyticsViewer(AcceptsOneWidget panel, EventDTO event, String leaderboardName, LeaderboardType leaderboardType, boolean showRaceDetails) {
String leaderboardDisplayName = Window.Location.getParameter("displayName");
if (leaderboardDisplayName == null || leaderboardDisplayName.isEmpty()) {
leaderboardDisplayName = leaderboardName;
}
long delayBetweenAutoAdvancesInMilliseconds = 3000l;
final RaceIdentifier preselectedRace = getPreselectedRace(Window.Location.getParameterMap());
// make a single live request as the default but don't continue to play by default
Timer timer = new Timer(PlayModes.Live, PlayStates.Paused, delayBetweenAutoAdvancesInMilliseconds);
final LeaderboardSettings leaderboardSettings = createLeaderboardSettingsFromURLParameters(Window.Location.getParameterMap());
if (leaderboardSettings.getDelayBetweenAutoAdvancesInMilliseconds() != null) {
timer.setPlayMode(PlayModes.Live); // the leaderboard, viewed via the entry point, goes "live" and "playing" if an auto-refresh
} // interval has been specified
boolean autoExpandLastRaceColumn = GwtHttpRequestUtils.getBooleanParameter(LeaderboardUrlSettings.PARAM_AUTO_EXPAND_LAST_RACE_COLUMN, false);
boolean showSeriesLeaderboards = GwtHttpRequestUtils.getBooleanParameter(LeaderboardUrlSettings.PARAM_SHOW_SERIES_LEADERBOARDS, false);
SeriesAnalyticsView analyticsView = clientFactory.createSeriesAnalyticsView(event, leaderboardName,
seriesPlace.getNavigationTab(), timerForClientServerOffset);
Window.setTitle(seriesPlace.getTitle(event.getName(), leaderboardDisplayName));
analyticsView.createSeriesAnalyticsViewer(clientFactory.getSailingService(), new AsyncActionsExecutor(),
timer, leaderboardSettings, null, preselectedRace, "leaderboardGroupName", leaderboardName, this,
userAgent, showRaceDetails, autoExpandLastRaceColumn, showSeriesLeaderboards);
panel.setWidget(analyticsView.asWidget());
}
/**
* Constructs {@link LeaderboardSettings} from the URL parameters found
*/
private LeaderboardSettings createLeaderboardSettingsFromURLParameters(Map<String, List<String>> parameterMap) {
LeaderboardSettings result;
Long refreshIntervalMillis = parameterMap.containsKey(LeaderboardUrlSettings.PARAM_REFRESH_INTERVAL_MILLIS) ? Long
.valueOf(parameterMap.get(LeaderboardUrlSettings.PARAM_REFRESH_INTERVAL_MILLIS).get(0)) : null;
RaceColumnSelectionStrategies raceColumnSelectionStrategy;
final Integer numberOfLastRacesToShow;
if (parameterMap.containsKey(LeaderboardUrlSettings.PARAM_NAME_LAST_N)) {
raceColumnSelectionStrategy = RaceColumnSelectionStrategies.LAST_N;
numberOfLastRacesToShow = Integer.valueOf(parameterMap.get(LeaderboardUrlSettings.PARAM_NAME_LAST_N).get(0));
} else if (isSmallWidth()) {
raceColumnSelectionStrategy = RaceColumnSelectionStrategies.LAST_N;
int width = Window.getClientWidth();
numberOfLastRacesToShow = (width-275)/40;
} else {
raceColumnSelectionStrategy = RaceColumnSelectionStrategies.EXPLICIT;
numberOfLastRacesToShow = null;
}
if (parameterMap.containsKey(LeaderboardUrlSettings.PARAM_RACE_NAME) || parameterMap.containsKey(LeaderboardUrlSettings.PARAM_RACE_DETAIL) ||
parameterMap.containsKey(LeaderboardUrlSettings.PARAM_LEG_DETAIL) || parameterMap.containsKey(LeaderboardUrlSettings.PARAM_MANEUVER_DETAIL) ||
parameterMap.containsKey(LeaderboardUrlSettings.PARAM_OVERALL_DETAIL) || parameterMap.containsKey(LeaderboardUrlSettings.PARAM_SHOW_ADDED_SCORES) ||
parameterMap.containsKey(LeaderboardUrlSettings.PARAM_SHOW_OVERALL_COLUMN_WITH_NUMBER_OF_RACES_COMPLETED)) {
List<DetailType> maneuverDetails = getDetailTypeListFromParamValue(parameterMap.get(LeaderboardUrlSettings.PARAM_MANEUVER_DETAIL));
List<DetailType> raceDetails = getDetailTypeListFromParamValue(parameterMap.get(LeaderboardUrlSettings.PARAM_RACE_DETAIL));
List<DetailType> overallDetails = getDetailTypeListFromParamValue(parameterMap.get(LeaderboardUrlSettings.PARAM_OVERALL_DETAIL));
List<DetailType> legDetails = getDetailTypeListFromParamValue(parameterMap.get(LeaderboardUrlSettings.PARAM_LEG_DETAIL));
List<String> namesOfRacesToShow = getStringListFromParamValue(parameterMap.get(LeaderboardUrlSettings.PARAM_RACE_NAME));
boolean showAddedScores = parameterMap.containsKey(LeaderboardUrlSettings.PARAM_SHOW_ADDED_SCORES) ?
Boolean.valueOf(parameterMap.get(LeaderboardUrlSettings.PARAM_SHOW_ADDED_SCORES).get(0)) : false;
boolean showOverallColumnWithNumberOfRacesSailedPerCompetitor = parameterMap.containsKey(LeaderboardUrlSettings.PARAM_SHOW_OVERALL_COLUMN_WITH_NUMBER_OF_RACES_COMPLETED) ?
Boolean.valueOf(parameterMap.get(LeaderboardUrlSettings.PARAM_SHOW_OVERALL_COLUMN_WITH_NUMBER_OF_RACES_COMPLETED).get(0)) : false;
boolean autoExpandPreSelectedRace = parameterMap.containsKey(LeaderboardUrlSettings.PARAM_AUTO_EXPAND_PRESELECTED_RACE) ?
Boolean.valueOf(parameterMap.get(LeaderboardUrlSettings.PARAM_AUTO_EXPAND_PRESELECTED_RACE).get(0)) :
(namesOfRacesToShow != null && namesOfRacesToShow.size() == 1);
result = new LeaderboardSettings(maneuverDetails, legDetails, raceDetails, overallDetails,
/* namesOfRaceColumnsToShow */ null,
namesOfRacesToShow, numberOfLastRacesToShow,
autoExpandPreSelectedRace, refreshIntervalMillis, /* sort by column */ (namesOfRacesToShow != null && !namesOfRacesToShow.isEmpty()) ?
namesOfRacesToShow.get(0) : null,
/* ascending */ true, /* updateUponPlayStateChange */ raceDetails.isEmpty() && legDetails.isEmpty(),
raceColumnSelectionStrategy, showAddedScores, showOverallColumnWithNumberOfRacesSailedPerCompetitor);
} else {
final List<DetailType> overallDetails = Collections.singletonList(DetailType.REGATTA_RANK);
result = LeaderboardSettingsFactory.getInstance().createNewDefaultSettings(null, null,
/* overallDetails */ overallDetails, null,
/* autoExpandFirstRace */false, refreshIntervalMillis, numberOfLastRacesToShow,
raceColumnSelectionStrategy);
}
return result;
}
private RaceIdentifier getPreselectedRace(Map<String, List<String>> parameterMap) {
RaceIdentifier result;
if (parameterMap.containsKey(LeaderboardUrlSettings.PARAM_RACE_NAME) && parameterMap.get(LeaderboardUrlSettings.PARAM_RACE_NAME).size() == 1 &&
parameterMap.containsKey(LeaderboardUrlSettings.PARAM_REGATTA_NAME) && parameterMap.get(LeaderboardUrlSettings.PARAM_REGATTA_NAME).size() == 1) {
result = new RegattaNameAndRaceName(parameterMap.get(LeaderboardUrlSettings.PARAM_REGATTA_NAME).get(0), parameterMap.get(LeaderboardUrlSettings.PARAM_RACE_NAME).get(0));
} else {
result = null;
}
return result;
}
private List<DetailType> getDetailTypeListFromParamValue(List<String> list) {
List<DetailType> result = new ArrayList<DetailType>();
if (list != null) {
for (String entry : list) {
try {
result.add(DetailType.valueOf(entry));
} catch (IllegalArgumentException e) {
}
}
}
return result;
}
private List<String> getStringListFromParamValue(List<String> list) {
List<String> result = new ArrayList<String>();
if (list != null) {
result.addAll(list);
}
return result;
}
private void createErrorView(String errorMessage, Throwable errorReason, AcceptsOneWidget panel) {
ErrorView view = clientFactory.createErrorView(errorMessage, errorReason);
panel.setWidget(view.asWidget());
}
public boolean isSmallWidth() {
int width = Window.getClientWidth();
return width <= 720;
}
@Override
public void reportError(String message) {
Window.alert(message);
}
@Override
public void reportError(String message, boolean silentMode) {
if (silentMode) {
Window.setStatus(message);
} else {
reportError(message);
}
}
@Override
public void reportPersistentInformation(String message) {
Window.setStatus(message);
}
}
@@ -0,0 +1,25 @@
package com.sap.sailing.gwt.home.client.place.series;
import com.google.gwt.core.client.GWT;
import com.sap.sse.gwt.client.mvp.AbstractActivityProxy;
public class SeriesActivityProxy extends AbstractActivityProxy {
private final SeriesClientFactory clientFactory;
private final SeriesPlace place;
public SeriesActivityProxy(SeriesPlace place, SeriesClientFactory clientFactory) {
this.place = place;
this.clientFactory = clientFactory;
}
@Override
protected void startAsync() {
GWT.runAsync(new AbstractRunAsyncCallback() {
@Override
public void onSuccess() {
super.onSuccess(new SeriesActivity(place, clientFactory));
}
});
}
}
@@ -0,0 +1,20 @@
package com.sap.sailing.gwt.home.client.place.series;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.domain.common.RaceIdentifier;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardSettings;
import com.sap.sse.gwt.client.ErrorReporter;
import com.sap.sse.gwt.client.async.AsyncActionsExecutor;
import com.sap.sse.gwt.client.player.Timer;
import com.sap.sse.gwt.client.useragent.UserAgentDetails;
public interface SeriesAnalyticsView {
Widget asWidget();
void createSeriesAnalyticsViewer(SailingServiceAsync sailingService, AsyncActionsExecutor asyncActionsExecutor,
Timer timer, LeaderboardSettings leaderboardSettings, String preselectedLeaderboardName, RaceIdentifier preselectedRace,
String leaderboardGroupName, String metaLeaderboardName, ErrorReporter errorReporter,
UserAgentDetails userAgent, boolean showRaceDetails,
boolean autoExpandLastRaceColumn, boolean showSeriesLeaderboards);
}
@@ -0,0 +1,10 @@
package com.sap.sailing.gwt.home.client.place.series;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace.SeriesNavigationTabs;
import com.sap.sailing.gwt.ui.client.SailingClientFactory;
import com.sap.sailing.gwt.ui.shared.EventDTO;
import com.sap.sse.gwt.client.player.Timer;
public interface SeriesClientFactory extends SailingClientFactory {
SeriesAnalyticsView createSeriesAnalyticsView(EventDTO event, String leaderboardName, SeriesNavigationTabs navigationTab, Timer timerForClientServerOffset);
}
@@ -0,0 +1,81 @@
package com.sap.sailing.gwt.home.client.place.series;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.sap.sailing.gwt.common.client.AbstractBasePlace;
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
public class SeriesPlace extends AbstractBasePlace {
private final String eventUuidAsString;
private final String leaderboardIdAsNameString;
private final Boolean showRaceDetails;
private final Boolean showSettings;
private final SeriesNavigationTabs navigationTab;
private final static String PARAM_EVENTID = "eventId";
private final static String PARAM_LEADERBOARD_NAME = "leaderboardName";
private final static String PARAM_SHOW_RACE_DETAILS = "showRaceDetails";
private final static String PARAM_SHOW_SETTINGS = "showSettings";
private final static String PARAM_NAVIGATION_TAB = "navigationTab";
public enum SeriesNavigationTabs { OverallLeaderboard, RegattaLeaderboards, CompetitorAnalytics };
public SeriesPlace(String url) {
super(url);
eventUuidAsString = getParameter(PARAM_EVENTID);
leaderboardIdAsNameString = getParameter(PARAM_LEADERBOARD_NAME);
showRaceDetails = Boolean.valueOf(getParameter(PARAM_SHOW_RACE_DETAILS));
showSettings = Boolean.valueOf(getParameter(PARAM_SHOW_SETTINGS));
String paramNavTab = getParameter(PARAM_NAVIGATION_TAB);
if(paramNavTab != null) {
navigationTab = SeriesNavigationTabs.valueOf(paramNavTab);
} else {
navigationTab = SeriesNavigationTabs.OverallLeaderboard;
}
}
public SeriesPlace(String eventUuidAsString, SeriesNavigationTabs navigationTab, String leaderboardIdAsNameString, Boolean showRaceDetails, Boolean showSettings) {
super(PARAM_EVENTID, eventUuidAsString, PARAM_NAVIGATION_TAB, navigationTab.name(), PARAM_LEADERBOARD_NAME, leaderboardIdAsNameString,
PARAM_SHOW_RACE_DETAILS, String.valueOf(showRaceDetails), PARAM_SHOW_SETTINGS, String.valueOf(showSettings));
this.eventUuidAsString = eventUuidAsString;
this.navigationTab = navigationTab;
this.leaderboardIdAsNameString = leaderboardIdAsNameString;
this.showRaceDetails = showRaceDetails;
this.showSettings = showSettings;
}
public String getTitle(String eventName, String leaderboardName) {
return TextMessages.INSTANCE.sapSailing() + " - " + TextMessages.INSTANCE.leaderboard() + ": " + leaderboardName;
}
public String getEventUuidAsString() {
return eventUuidAsString;
}
public SeriesNavigationTabs getNavigationTab() {
return navigationTab;
}
public String getLeaderboardIdAsNameString() {
return leaderboardIdAsNameString;
}
public Boolean getShowRaceDetails() {
return showRaceDetails;
}
public Boolean getShowSettings() {
return showSettings;
}
public static class Tokenizer implements PlaceTokenizer<SeriesPlace> {
@Override
public String getToken(SeriesPlace place) {
return place.getParametersAsToken();
}
@Override
public SeriesPlace getPlace(String url) {
return new SeriesPlace(url);
}
}
}
@@ -1,4 +1,4 @@
package com.sap.sailing.gwt.home.client.place.leaderboard;
package com.sap.sailing.gwt.home.client.place.series;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
@@ -7,8 +7,8 @@ import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.domain.common.RaceIdentifier;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.place.event.regattaanalytics.RegattaAnalytics;
import com.sap.sailing.gwt.home.client.place.event.seriesanalytics.EventSeriesAnalytics;
import com.sap.sailing.gwt.home.client.place.series.SeriesPlace.SeriesNavigationTabs;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardSettings;
import com.sap.sailing.gwt.ui.shared.EventDTO;
@@ -17,35 +17,22 @@ import com.sap.sse.gwt.client.async.AsyncActionsExecutor;
import com.sap.sse.gwt.client.player.Timer;
import com.sap.sse.gwt.client.useragent.UserAgentDetails;
public class TabletAndDesktopLeaderboardView extends Composite implements AnalyticsView {
private static LeaderboardPageViewUiBinder uiBinder = GWT.create(LeaderboardPageViewUiBinder.class);
public class TabletAndDesktopSeriesView extends Composite implements SeriesAnalyticsView {
private static TabletAndDesktopSeriesViewUiBinder uiBinder = GWT.create(TabletAndDesktopSeriesViewUiBinder.class);
interface LeaderboardPageViewUiBinder extends UiBinder<Widget, TabletAndDesktopLeaderboardView> {
interface TabletAndDesktopSeriesViewUiBinder extends UiBinder<Widget, TabletAndDesktopSeriesView> {
}
@UiField(provided=true) RegattaAnalytics regattaAnalytics;
@UiField(provided=true) EventSeriesAnalytics seriesAnalytics;
public TabletAndDesktopLeaderboardView(EventDTO event, String leaderboardName, Timer timerForClientServerOffset, HomePlacesNavigator placeNavigator) {
regattaAnalytics = new RegattaAnalytics(event, leaderboardName, timerForClientServerOffset, placeNavigator);
seriesAnalytics = new EventSeriesAnalytics(event, leaderboardName, timerForClientServerOffset, placeNavigator);
regattaAnalytics.setVisible(false);
seriesAnalytics.setVisible(false);
public TabletAndDesktopSeriesView(EventDTO event, String leaderboardName, SeriesNavigationTabs navigationTab, Timer timerForClientServerOffset, HomePlacesNavigator placeNavigator) {
seriesAnalytics = new EventSeriesAnalytics(event, leaderboardName, navigationTab, timerForClientServerOffset, placeNavigator);
initWidget(uiBinder.createAndBindUi(this));
seriesAnalytics.setVisible(false);
}
public void createRegattaAnalyticsViewer(final SailingServiceAsync sailingService, final AsyncActionsExecutor asyncActionsExecutor,
final Timer timer, final LeaderboardSettings leaderboardSettings, final RaceIdentifier preselectedRace,
final String leaderboardGroupName, String leaderboardName, final ErrorReporter errorReporter,
final UserAgentDetails userAgent, boolean showRaceDetails,
boolean autoExpandLastRaceColumn, boolean showOverallLeaderboard) {
regattaAnalytics.createRegattaAnalyticsViewer(sailingService, asyncActionsExecutor, timer, leaderboardSettings, preselectedRace,
leaderboardGroupName, leaderboardName, errorReporter, userAgent, showRaceDetails, autoExpandLastRaceColumn, showOverallLeaderboard);
regattaAnalytics.setVisible(true);
}
public void createSeriesAnalyticsViewer(SailingServiceAsync sailingService, AsyncActionsExecutor asyncActionsExecutor,
Timer timer, LeaderboardSettings leaderboardSettings, String preselectedLeaderboardName, RaceIdentifier preselectedRace,
String leaderboardGroupName, String metaLeaderboardName, ErrorReporter errorReporter,
@@ -5,7 +5,6 @@
<ui:with field="i18n" type="com.sap.sailing.gwt.common.client.i18n.TextMessages" />
<ui:with field="res" type="com.sap.sailing.gwt.common.client.SharedResources" />
<g:HTMLPanel>
<s:regattaanalytics.RegattaAnalytics ui:field='regattaAnalytics'/>
<s:seriesanalytics.EventSeriesAnalytics ui:field='seriesAnalytics'/>
</g:HTMLPanel>
</ui:UiBinder>
@@ -2,16 +2,24 @@ package com.sap.sailing.gwt.home.client.place.solutions;
import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
public class SolutionsActivity extends AbstractActivity {
private final SolutionsPlace solutionsPlace;
private final SolutionsClientFactory clientFactory;
public SolutionsActivity(SolutionsPlace place, SolutionsClientFactory clientFactory) {
this.solutionsPlace = place;
this.clientFactory = clientFactory;
}
@Override
public void start(AcceptsOneWidget panel, EventBus eventBus) {
panel.setWidget(new TabletAndDesktopSolutionsView());
SolutionsView solutionsView = clientFactory.createSolutionsView(solutionsPlace.getNavigationTab());
panel.setWidget(solutionsView.asWidget());
Window.setTitle(TextMessages.INSTANCE.sapSailing() + " - " + TextMessages.INSTANCE.solutions());
}
}
@@ -1,7 +1,8 @@
package com.sap.sailing.gwt.home.client.place.solutions;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace.SolutionsNavigationTabs;
import com.sap.sailing.gwt.ui.client.SailingClientFactory;
public interface SolutionsClientFactory extends SailingClientFactory {
SolutionsView createSolutionsView(SolutionsActivity activity);
SolutionsView createSolutionsView(SolutionsNavigationTabs navigationTab);
}
@@ -1,18 +1,39 @@
package com.sap.sailing.gwt.home.client.place.solutions;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.sap.sailing.gwt.common.client.AbstractBasePlace;
public class SolutionsPlace extends AbstractBasePlace {
public enum SolutionsNavigationTabs { SailingAnalytics, RaceCommiteeApp, PostRaceAnalytics, TrainingDiary, SailingSimulator };
private final SolutionsNavigationTabs navigationTab;
private final static String PARAM_NAVIGATION_TAB = "navigationTab";
public SolutionsPlace(String url) {
super(url);
String paramNavTab = getParameter(PARAM_NAVIGATION_TAB);
navigationTab = paramNavTab != null ? SolutionsNavigationTabs.valueOf(paramNavTab) : null;
}
public SolutionsPlace(SolutionsNavigationTabs navigationTab) {
super(PARAM_NAVIGATION_TAB, navigationTab.name());
this.navigationTab = navigationTab;
}
public SolutionsNavigationTabs getNavigationTab() {
return navigationTab;
}
public class SolutionsPlace extends Place {
public static class Tokenizer implements PlaceTokenizer<SolutionsPlace> {
@Override
public String getToken(SolutionsPlace place) {
return null;
return place.getParametersAsToken();
}
@Override
public SolutionsPlace getPlace(String token) {
return new SolutionsPlace();
public SolutionsPlace getPlace(String url) {
return new SolutionsPlace(url);
}
}
}
@@ -5,18 +5,22 @@ import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace.SolutionsNavigationTabs;
import com.sap.sailing.gwt.home.client.shared.solutions.Solutions;
public class TabletAndDesktopSolutionsView extends Composite implements SolutionsView {
private static SolutionsPageViewUiBinder uiBinder = GWT.create(SolutionsPageViewUiBinder.class);
@UiField Solutions solutions;
@UiField(provided=true) Solutions solutions;
interface SolutionsPageViewUiBinder extends UiBinder<Widget, TabletAndDesktopSolutionsView> {
}
public TabletAndDesktopSolutionsView() {
public TabletAndDesktopSolutionsView(SolutionsNavigationTabs navigationTab, HomePlacesNavigator placesNavigator) {
super();
solutions = new Solutions(navigationTab, placesNavigator);
initWidget(uiBinder.createAndBindUi(this));
}
}
@@ -3,5 +3,5 @@ package com.sap.sailing.gwt.home.client.place.sponsoring;
import com.sap.sailing.gwt.ui.client.SailingClientFactory;
public interface SponsoringClientFactory extends SailingClientFactory {
SponsoringView createSponsoringView(SponsoringActivity activity);
SponsoringView createSponsoringView();
}
@@ -10,6 +10,7 @@ import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.sap.sailing.gwt.common.client.DateUtil;
@@ -20,9 +21,11 @@ import com.sap.sse.common.Util.Pair;
public class StartActivity extends AbstractActivity {
private final StartClientFactory clientFactory;
private final StartPlace place;
public StartActivity(StartPlace place, StartClientFactory clientFactory) {
this.clientFactory = clientFactory;
this.place = place;
}
@Override
@@ -33,6 +36,7 @@ public class StartActivity extends AbstractActivity {
public void onSuccess(List<EventBaseDTO> result) {
final StartView view = clientFactory.createStartView();
panel.setWidget(view.asWidget());
Window.setTitle(place.getTitle());
fillStartPageEvents(view, result);
}
@@ -2,8 +2,13 @@ package com.sap.sailing.gwt.home.client.place.start;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
public class StartPlace extends Place {
public String getTitle() {
return TextMessages.INSTANCE.sapSailing();
}
public static class Tokenizer implements PlaceTokenizer<StartPlace> {
@Override
public String getToken(StartPlace place) {
@@ -4,7 +4,6 @@ import java.util.Arrays;
import java.util.List;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.AnchorElement;
import com.google.gwt.dom.client.StyleInjector;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.KeyCodes;
@@ -13,30 +12,34 @@ import com.google.gwt.event.dom.client.KeyPressHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
import com.sap.sailing.gwt.common.client.i18n.TextMessages;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.app.PlaceNavigation;
import com.sap.sailing.gwt.home.client.place.events.EventsPlace;
import com.sap.sailing.gwt.home.client.place.searchresult.SearchResultPlace;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace.SolutionsNavigationTabs;
import com.sap.sailing.gwt.home.client.place.start.StartPlace;
public class Header extends Composite {
@UiField Anchor startPageLink;
@UiField Anchor eventsPageLink;
@UiField Anchor solutionsPageLink;
@UiField AnchorElement homeLink;
// @UiField Anchor sponsoringPageLink;
@UiField TextBox searchText;
@UiField Button searchButton;
private static final HyperlinkImpl HYPERLINK_IMPL = GWT.create(HyperlinkImpl.class);
private final List<Anchor> links;
private final HomePlacesNavigator navigator;
@@ -60,7 +63,7 @@ public class Header extends Composite {
homeNavigation = navigator.getHomeNavigation();
eventsNavigation = navigator.getEventsNavigation();
solutionsNavigation = navigator.getSolutionsNavigation();
solutionsNavigation = navigator.getSolutionsNavigation(SolutionsNavigationTabs.SailingAnalytics);
startPageLink.setHref(homeNavigation.getTargetUrl());
eventsPageLink.setHref(eventsNavigation.getTargetUrl());
@@ -75,46 +78,26 @@ public class Header extends Composite {
}
}
});
// Event.sinkEvents(homeLink, Event.ONCLICK);
// Event.setEventListener(homeLink, new EventListener() {
// @Override
// public void onBrowserEvent(Event event) {
// switch (DOM.eventGetType(event)) {
// case Event.ONCLICK:
// navigator.goToHome();
// break;
// }
// }
// });
}
@UiHandler("startPageLink")
public void goToHome(ClickEvent e) {
navigator.goToPlace(homeNavigation);
e.preventDefault();
setActiveLink(startPageLink);
handleClickEvent(e, homeNavigation, startPageLink);
}
@UiHandler("eventsPageLink")
public void goToEvents(ClickEvent e) {
navigator.goToPlace(eventsNavigation);
e.preventDefault();
setActiveLink(eventsPageLink);
handleClickEvent(e, eventsNavigation, eventsPageLink);
}
@UiHandler("solutionsPageLink")
public void goToSolutions(ClickEvent e) {
navigator.goToPlace(solutionsNavigation);
e.preventDefault();
setActiveLink(solutionsPageLink);
handleClickEvent(e, solutionsNavigation, solutionsPageLink);
}
// @UiHandler("sponsoringPageLink")
// public void goToSponsoring(ClickEvent e) {
// navigator.goToPlace(sponsoringNavigation);
// e.preventDefault();
// setActiveLink(sponsoringPageLink);
// handleClickEvent(e, sponsoringNavigation, sponsoringPageLink);
// }
@UiHandler("searchButton")
@@ -138,4 +121,11 @@ public class Header extends Composite {
}
}
private void handleClickEvent(ClickEvent e, PlaceNavigation<?> placeNavigation, Anchor activeLink) {
if (HYPERLINK_IMPL.handleAsClick((Event) e.getNativeEvent())) {
navigator.goToPlace(placeNavigation);
e.preventDefault();
setActiveLink(activeLink);
}
}
}
@@ -9,7 +9,7 @@
<header class="{local_res.css.siteheader}">
<div class="{res.mainCss.grid}">
<div class="{res.mediaCss.small2} {res.mediaCss.large3} {res.mediaCss.columns}">
<a ui:field="homeLink" href="javascript:;">
<a href="http://sapsponsorships.com">
<g:Image resource="{local_res.logo}" pixelSize="80, 40" altText="SAP Sailing Analytics" styleName="{local_res.css.logo}"/>
</a>
<p class="{local_res.css.logotitle}">Sailing Analytics</p>
@@ -11,6 +11,7 @@ import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.app.PlaceNavigation;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace.SolutionsNavigationTabs;
import com.sap.sailing.gwt.home.client.place.sponsoring.SponsoringPlace;
public class MainSponsors extends Composite {
@@ -34,7 +35,7 @@ public class MainSponsors extends Composite {
MainSponsorsResources.INSTANCE.css().ensureInjected();
initWidget(uiBinder.createAndBindUi(this));
solutionsNavigation = navigator.getSolutionsNavigation();
solutionsNavigation = navigator.getSolutionsNavigation(SolutionsNavigationTabs.SailingAnalytics);
sponsoringNavigation = navigator.getSponsoringNavigation();
solutionsPageLink.setHref(solutionsNavigation.getTargetUrl());
@@ -1,17 +1,33 @@
package com.sap.sailing.gwt.home.client.shared.solutions;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.StyleInjector;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
import com.sap.sailing.gwt.home.client.app.PlaceNavigation;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace;
import com.sap.sailing.gwt.home.client.place.solutions.SolutionsPlace.SolutionsNavigationTabs;
public class Solutions extends Composite {
interface SolutionsUiBinder extends UiBinder<Widget, Solutions> {
}
private static SolutionsUiBinder uiBinder = GWT.create(SolutionsUiBinder.class);
private static final HyperlinkImpl HYPERLINK_IMPL = GWT.create(HyperlinkImpl.class);
@UiField Anchor sailingAnalyticsAnchor;
@UiField Anchor raceAnchor;
@@ -25,41 +41,100 @@ public class Solutions extends Composite {
@UiField DivElement trainingDiaryDiv;
@UiField DivElement simulatorDiv;
interface SolutionsUiBinder extends UiBinder<Widget, Solutions> {
}
private final PlaceNavigation<SolutionsPlace> sailingAnalyticsNavigation;
private final PlaceNavigation<SolutionsPlace> raceCommitteeAppNavigation;
private final PlaceNavigation<SolutionsPlace> postRaceAnalyticsNavigation;
private final PlaceNavigation<SolutionsPlace> trainingDiaryNavigation;
private final PlaceNavigation<SolutionsPlace> sailingSimulatorNavigation;
private static SolutionsUiBinder uiBinder = GWT.create(SolutionsUiBinder.class);
public Solutions() {
private final SolutionsNavigationTabs navigationTab;
public Solutions(SolutionsNavigationTabs navigationTab, HomePlacesNavigator placesNavigator) {
this.navigationTab = navigationTab;
SolutionsResources.INSTANCE.css().ensureInjected();
StyleInjector.injectAtEnd("@media (min-width: 25em) { "+SolutionsResources.INSTANCE.mediumCss().getText()+"}");
StyleInjector.injectAtEnd("@media (min-width: 50em) { "+SolutionsResources.INSTANCE.largeCss().getText()+"}");
initWidget(uiBinder.createAndBindUi(this));
sailingAnalyticsNavigation = placesNavigator.getSolutionsNavigation(SolutionsNavigationTabs.SailingAnalytics);
raceCommitteeAppNavigation = placesNavigator.getSolutionsNavigation(SolutionsNavigationTabs.RaceCommiteeApp);
postRaceAnalyticsNavigation = placesNavigator.getSolutionsNavigation(SolutionsNavigationTabs.PostRaceAnalytics);
trainingDiaryNavigation = placesNavigator.getSolutionsNavigation(SolutionsNavigationTabs.TrainingDiary);
sailingSimulatorNavigation = placesNavigator.getSolutionsNavigation(SolutionsNavigationTabs.SailingSimulator);
sailingAnalyticsAnchor.setHref(sailingAnalyticsNavigation.getTargetUrl());
raceAnchor.setHref(raceCommitteeAppNavigation.getTargetUrl());
postRaceAnchor.setHref(postRaceAnalyticsNavigation.getTargetUrl());
trainingDiaryAnchor.setHref(trainingDiaryNavigation.getTargetUrl());
simulatorAnchor.setHref(sailingSimulatorNavigation.getTargetUrl());
}
@Override
protected void onLoad() {
Scheduler.get().scheduleDeferred(new Command() {
public void execute() {
scrollToView(navigationTab);
}
});
}
@UiHandler("sailingAnalyticsAnchor")
public void scrollToSailingAnalytics(ClickEvent e) {
sailingAnalyticsDiv.scrollIntoView();
scrollToView(SolutionsNavigationTabs.SailingAnalytics);
handleClickEvent(e, sailingAnalyticsNavigation);
}
@UiHandler("raceAnchor")
public void scrollToRace(ClickEvent e) {
raceDiv.scrollIntoView();
scrollToView(SolutionsNavigationTabs.RaceCommiteeApp);
handleClickEvent(e, raceCommitteeAppNavigation);
}
@UiHandler("postRaceAnchor")
public void scrollToPostRace(ClickEvent e) {
postRaceDiv.scrollIntoView();
scrollToView(SolutionsNavigationTabs.PostRaceAnalytics);
handleClickEvent(e, postRaceAnalyticsNavigation);
}
@UiHandler("trainingDiaryAnchor")
public void scrollToTrainingDiary(ClickEvent e) {
trainingDiaryDiv.scrollIntoView();
scrollToView(SolutionsNavigationTabs.TrainingDiary);
handleClickEvent(e, trainingDiaryNavigation);
}
@UiHandler("simulatorAnchor")
public void scrollToSimulator(ClickEvent e) {
simulatorDiv.scrollIntoView();
scrollToView(SolutionsNavigationTabs.SailingSimulator);
handleClickEvent(e, sailingSimulatorNavigation);
}
private void scrollToView(SolutionsNavigationTabs navigationTab) {
switch (navigationTab) {
case SailingAnalytics:
Window.scrollTo(0, 0);
break;
case RaceCommiteeApp:
raceDiv.scrollIntoView();
break;
case PostRaceAnalytics:
postRaceDiv.scrollIntoView();
break;
case TrainingDiary:
trainingDiaryDiv.scrollIntoView();
break;
case SailingSimulator:
simulatorDiv.scrollIntoView();
break;
}
}
private void handleClickEvent(ClickEvent e, PlaceNavigation<?> placeNavigation) {
if (HYPERLINK_IMPL.handleAsClick((Event) e.getNativeEvent())) {
// don't use the placecontroller for navigation here as we want to avoid a page reload
History.newItem(placeNavigation.getHistoryUrl(), false);
e.preventDefault();
}
}
}
@@ -12,11 +12,11 @@
<div class="{local_res.css.solutions_nav}">
<div class="{res.mainCss.grid} {local_res.css.gridalternator}">
<div class="{res.mediaCss.small12} {res.mediaCss.columns}">
<g:Anchor ui:field="sailingAnalyticsAnchor" href="javascript:;" styleName="{local_res.css.solutions_nav_link}"><ui:text from='{i18n.solutionsSAPHeadline}'/></g:Anchor>
<g:Anchor ui:field="raceAnchor" href="javascript:;" styleName="{local_res.css.solutions_nav_link}"><ui:text from='{i18n.solutionsRaceHeadline}'/></g:Anchor>
<g:Anchor ui:field="postRaceAnchor" href="javascript:;" styleName="{local_res.css.solutions_nav_link}"><ui:text from='{i18n.solutionsPostHeadline}'/></g:Anchor>
<g:Anchor ui:field="trainingDiaryAnchor" href="javascript:;" styleName="{local_res.css.solutions_nav_link}"><ui:text from='{i18n.solutionsTrainingHeadline}'/></g:Anchor>
<g:Anchor ui:field="simulatorAnchor" href="javascript:;" styleName="{local_res.css.solutions_nav_link}" ><ui:text from='{i18n.solutionsSimulatorHeadline}'/></g:Anchor>
<g:Anchor ui:field="sailingAnalyticsAnchor" styleName="{local_res.css.solutions_nav_link}"><ui:text from='{i18n.solutionsSAPHeadline}'/></g:Anchor>
<g:Anchor ui:field="raceAnchor" styleName="{local_res.css.solutions_nav_link}"><ui:text from='{i18n.solutionsRaceHeadline}'/></g:Anchor>
<g:Anchor ui:field="postRaceAnchor" styleName="{local_res.css.solutions_nav_link}"><ui:text from='{i18n.solutionsPostHeadline}'/></g:Anchor>
<g:Anchor ui:field="trainingDiaryAnchor" styleName="{local_res.css.solutions_nav_link}"><ui:text from='{i18n.solutionsTrainingHeadline}'/></g:Anchor>
<g:Anchor ui:field="simulatorAnchor" styleName="{local_res.css.solutions_nav_link}" ><ui:text from='{i18n.solutionsSimulatorHeadline}'/></g:Anchor>
</div>
</div>
</div>
@@ -449,12 +449,20 @@ public abstract class AbstractLeaderboardConfigPanel extends FormPanel implement
}
@Override
public void changeTrackingRace(Iterable<? extends RegattaAndRaceIdentifier> regattaAndRaceIdentifiers, boolean isTracked) {
public void racesStoppedTracking(Iterable<? extends RegattaAndRaceIdentifier> regattaAndRaceIdentifiers) {
// nothing needs to be done here; the race doesn't change its linkedness status only because it stopped tracking
}
/**
* When a race is removed from the server, it will also have been unlinked. Represent the unlinking by clearing the
* tracked race link for any race column / fleet that points to it:
*/
@Override
public void racesRemoved(Iterable<? extends RegattaAndRaceIdentifier> regattaAndRaceIdentifiers) {
for (RegattaAndRaceIdentifier regattaAndRaceIdentifier : regattaAndRaceIdentifiers) {
for (RaceColumnDTOAndFleetDTOWithNameBasedEquality raceColumnAndFleetName : raceColumnTable.getDataProvider().getList()) {
if (raceColumnAndFleetName.getA().getRaceColumnName().equals(regattaAndRaceIdentifier.getRaceName())) {
raceColumnAndFleetName.getA().setRaceIdentifier(raceColumnAndFleetName.getB(),
regattaAndRaceIdentifier);
if (Util.equalsWithNull(raceColumnAndFleetName.getA().getRaceIdentifier(raceColumnAndFleetName.getB()), regattaAndRaceIdentifier)) {
raceColumnAndFleetName.getA().setRaceIdentifier(raceColumnAndFleetName.getB(), null);
}
}
raceColumnTable.getDataProvider().refresh();
@@ -1,6 +1,5 @@
package com.sap.sailing.gwt.ui.adminconsole;
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import java.util.List;
@@ -24,6 +23,7 @@ import com.google.gwt.view.client.SelectionModel;
import com.google.gwt.view.client.SingleSelectionModel;
import com.sap.sailing.domain.common.dto.CompetitorDTO;
import com.sap.sailing.domain.common.racelog.tracking.DeviceMappingConstants;
import com.sap.sailing.domain.common.racelog.tracking.MappableToDevice;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.shared.BetterDateTimeBox;
@@ -43,7 +43,7 @@ public class AddDeviceMappingDialog extends DataEntryDialog<DeviceMappingDTO> {
private final MarkTableWrapper<SingleSelectionModel<MarkDTO>> markTable;
private final StringMessages stringMessages;
private Serializable selectedItem;
private MappableToDevice selectedItem;
public AddDeviceMappingDialog(SailingServiceAsync sailingService, final ErrorReporter errorReporter,
final StringMessages stringMessages, String leaderboardName, String raceColumnName, String fleetName,
@@ -5,12 +5,8 @@ import java.util.List;
import java.util.Set;
import com.google.gwt.core.client.GWT;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.user.client.ui.TabLayoutPanel;
import com.sap.sailing.gwt.ui.client.AbstractSailingEntryPoint;
@@ -33,13 +29,11 @@ import com.sap.sailing.gwt.ui.shared.SecurityStylesheetResources;
import com.sap.sailing.gwt.ui.shared.StrippedLeaderboardDTO;
import com.sap.sse.gwt.adminconsole.AdminConsolePanel;
import com.sap.sse.gwt.adminconsole.DefaultRefreshableAdminConsolePanel;
import com.sap.sse.gwt.adminconsole.SystemInformationPanel;
import com.sap.sse.gwt.client.EntryPointHelper;
import com.sap.sse.gwt.client.async.AsyncActionsExecutor;
import com.sap.sse.gwt.client.async.MarkedAsyncCallback;
import com.sap.sse.security.ui.client.component.UserManagementPanel;
import com.sap.sse.security.ui.client.i18n.StringMessages;
import com.sap.sse.security.ui.loginpanel.LoginPanel;
public class AdminConsoleEntryPoint extends AbstractSailingEntryPoint implements RegattaRefresher, LeaderboardsRefresher, LeaderboardGroupsRefresher {
private Set<RegattasDisplayer> regattasDisplayers;
@@ -75,10 +69,10 @@ public class AdminConsoleEntryPoint extends AbstractSailingEntryPoint implements
}, getStringMessages().events(), SailingAdminConsoleFeatures.MANAGE_EVENTS);
leaderboardGroupsDisplayers.add(eventManagementPanel);
RegattaStructureManagementPanel regattaManagementPanel = new RegattaStructureManagementPanel(
RegattaManagementPanel regattaManagementPanel = new RegattaManagementPanel(
sailingService, this, getStringMessages(), this);
regattaManagementPanel.ensureDebugId("RegattaStructureManagement");
panel.addToVerticalTabPanel(new DefaultRefreshableAdminConsolePanel<RegattaStructureManagementPanel>(regattaManagementPanel) {
panel.addToVerticalTabPanel(new DefaultRefreshableAdminConsolePanel<RegattaManagementPanel>(regattaManagementPanel) {
@Override
public void refreshAfterBecomingVisible() {
fillRegattas();
@@ -227,21 +221,6 @@ public class AdminConsoleEntryPoint extends AbstractSailingEntryPoint implements
fillRegattas();
fillLeaderboardGroups();
fillLeaderboards();
final DockPanel informationPanel = new DockPanel();
informationPanel.setSize("100%", "95%");
informationPanel.setSpacing(10);
informationPanel.add(new LoginPanel(SecurityStylesheetResources.INSTANCE.css(), getUserService()), DockPanel.WEST);
informationPanel.add(persistentAlertLabel, DockPanel.CENTER);
SystemInformationPanel sysinfoPanel = new SystemInformationPanel(sailingService, this);
sysinfoPanel.ensureDebugId("SystemInformation");
final Anchor releaseNotesLink = new Anchor(new SafeHtmlBuilder().appendEscaped(getStringMessages().releaseNotes()).toSafeHtml(), "/release_notes_admin.html");
sysinfoPanel.add(releaseNotesLink);
informationPanel.add(sysinfoPanel, DockPanel.EAST);
informationPanel.setCellHorizontalAlignment(sysinfoPanel, HasHorizontalAlignment.ALIGN_RIGHT);
RootLayoutPanel rootPanel = RootLayoutPanel.get();
rootPanel.add(panel);
}
@@ -1,6 +1,5 @@
package com.sap.sailing.gwt.ui.adminconsole;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -15,6 +14,7 @@ import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.view.client.SelectionChangeEvent;
import com.google.gwt.view.client.SingleSelectionModel;
import com.sap.sailing.domain.common.dto.CompetitorDTO;
import com.sap.sailing.domain.common.racelog.tracking.MappableToDevice;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.shared.DeviceIdentifierDTO;
@@ -31,7 +31,7 @@ public class ImportFixesAndAddMappingsDialog extends DataEntryDialog<Collection<
private final MarkTableWrapper<SingleSelectionModel<MarkDTO>> markTable;
private final StringMessages stringMessages;
private final Map<TrackFileImportDeviceIdentifierDTO, Serializable> mappings = new HashMap<>();
private final Map<TrackFileImportDeviceIdentifierDTO, MappableToDevice> mappings = new HashMap<>();
private TrackFileImportDeviceIdentifierDTO deviceToSelect;
private CompetitorDTO compToSelect;
@@ -130,7 +130,7 @@ public class ImportFixesAndAddMappingsDialog extends DataEntryDialog<Collection<
}
}
private void mappedToSelectionChanged(Serializable mappedTo) {
private void mappedToSelectionChanged(MappableToDevice mappedTo) {
if (! inInstableTransitionState) {
TrackFileImportDeviceIdentifierDTO device = deviceIdTable.getSelectionModel().getSelectedObject();
if (device != null) {
@@ -155,7 +155,7 @@ public class ImportFixesAndAddMappingsDialog extends DataEntryDialog<Collection<
markToSelect = null;
if (deviceId != null) {
Serializable mappedTo = mappings.get(deviceId);
MappableToDevice mappedTo = mappings.get(deviceId);
if (mappedTo instanceof CompetitorDTO) {
compToSelect = (CompetitorDTO) mappedTo;
} else if (mappedTo instanceof MarkDTO) {
@@ -192,7 +192,7 @@ public class ImportFixesAndAddMappingsDialog extends DataEntryDialog<Collection<
List<DeviceMappingDTO> result = new ArrayList<>();
for (TrackFileImportDeviceIdentifierDTO device : mappings.keySet()) {
DeviceIdentifierDTO deviceIdDto = new DeviceIdentifierDTO("FILE", device.uuidAsString);
Serializable mappedTo = mappings.get(device);
MappableToDevice mappedTo = mappings.get(device);
DeviceMappingDTO mapping = new DeviceMappingDTO(deviceIdDto, device.from, device.to,
mappedTo, null);
result.add(mapping);
@@ -312,7 +312,6 @@ TrackedRaceChangedListener, LeaderboardsDisplayer {
@Override
public boolean isEnabled() {
return getSelectedLeaderboard() != null && !getSelectedLeaderboard().type.isRegattaLeaderboard();
}
})) {
@Override
@@ -374,6 +374,7 @@ public class RegattaDetailsComposite extends Composite {
private void updateRegattaDetails() {
if (regatta != null) {
mainPanel.setCaptionText(stringMessages.regatta() + " " + regatta.getName());
regattaName.setText(regatta.getName());
boatClassName.setText(regatta.boatClass != null ? regatta.boatClass.getName() : "");
defaultCourseArea.setText(regatta.defaultCourseAreaUuid == null ? "" : regatta.defaultCourseAreaName);
@@ -23,7 +23,6 @@ import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.view.client.ListDataProvider;
import com.google.gwt.view.client.MultiSelectionModel;
import com.google.gwt.view.client.SelectionChangeEvent;
import com.google.gwt.view.client.SelectionModel;
import com.sap.sailing.domain.common.RegattaIdentifier;
import com.sap.sailing.domain.common.RegattaName;
import com.sap.sailing.domain.common.impl.NaturalComparator;
@@ -32,6 +31,7 @@ import com.sap.sailing.gwt.ui.client.RegattaSelectionProvider;
import com.sap.sailing.gwt.ui.client.RegattasDisplayer;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.client.shared.controls.SelectionCheckboxColumn;
import com.sap.sailing.gwt.ui.shared.EventDTO;
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
import com.sap.sailing.gwt.ui.shared.SeriesDTO;
@@ -42,7 +42,7 @@ import com.sap.sse.gwt.client.panels.LabeledAbstractFilterablePanel;
public class RegattaListComposite extends Composite implements RegattasDisplayer {
private final SelectionModel<RegattaDTO> regattaSelectionModel;
private final MultiSelectionModel<RegattaDTO> regattaSelectionModel;
private final CellTable<RegattaDTO> regattaTable;
private ListDataProvider<RegattaDTO> regattaListDataProvider;
private List<RegattaDTO> allRegattas;
@@ -90,6 +90,7 @@ public class RegattaListComposite extends Composite implements RegattasDisplayer
regattaTable = createRegattaTable();
regattaTable.ensureDebugId("RegattasCellTable");
regattaTable.setVisible(false);
filterablePanelRegattas = new LabeledAbstractFilterablePanel<RegattaDTO>(filterRegattasLabel, allRegattas,
regattaTable, regattaListDataProvider) {
@Override
@@ -105,7 +106,10 @@ public class RegattaListComposite extends Composite implements RegattasDisplayer
filterablePanelRegattas.getTextBox().ensureDebugId("ReggatasFilterTextBox");
panel.add(filterablePanelRegattas);
regattaSelectionModel = new MultiSelectionModel<RegattaDTO>();
@SuppressWarnings("unchecked")
MultiSelectionModel<RegattaDTO> multiSelectionModel = (MultiSelectionModel<RegattaDTO>) regattaTable.getSelectionModel();
regattaSelectionModel = multiSelectionModel;
regattaSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
@@ -117,7 +121,6 @@ public class RegattaListComposite extends Composite implements RegattasDisplayer
RegattaListComposite.this.regattaSelectionProvider.setSelection(selectedRaceIdentifiers);
}
});
regattaTable.setSelectionModel(regattaSelectionModel);
panel.add(regattaTable);
@@ -129,6 +132,19 @@ public class RegattaListComposite extends Composite implements RegattasDisplayer
regattaListDataProvider.addDataDisplay(table);
table.setWidth("100%");
SelectionCheckboxColumn<RegattaDTO> regattaSelectionCheckboxColumn = new SelectionCheckboxColumn<RegattaDTO>(tableRes.cellTableStyle().cellTableCheckboxSelected(),
tableRes.cellTableStyle().cellTableCheckboxDeselected(), tableRes.cellTableStyle().cellTableCheckboxColumnCell()) {
@Override
protected ListDataProvider<RegattaDTO> getListDataProvider() {
return regattaListDataProvider;
}
@Override
public Boolean getValue(RegattaDTO row) {
return regattaTable.getSelectionModel().isSelected(row);
}
};
ListHandler<RegattaDTO> columnSortHandler = new ListHandler<RegattaDTO>(regattaListDataProvider.getList());
table.addColumnSortHandler(columnSortHandler);
@@ -175,9 +191,11 @@ public class RegattaListComposite extends Composite implements RegattasDisplayer
}
});
table.addColumn(regattaSelectionCheckboxColumn, regattaSelectionCheckboxColumn.getHeader());
table.addColumn(regattaNameColumn, stringMessages.regattaName());
table.addColumn(regattaBoatClassColumn, stringMessages.boatClass());
table.addColumn(regattaActionColumn, stringMessages.actions());
table.setSelectionModel(regattaSelectionCheckboxColumn.getSelectionModel(), regattaSelectionCheckboxColumn.getSelectionManager());
return table;
}
@@ -6,14 +6,12 @@ import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.CaptionPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.VerticalPanel;
@@ -40,7 +38,7 @@ import com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback;
* @author Frank Mittag (C5163974)
*
*/
public class RegattaStructureManagementPanel extends SimplePanel implements RegattasDisplayer, RegattaSelectionChangeListener {
public class RegattaManagementPanel extends SimplePanel implements RegattasDisplayer, RegattaSelectionChangeListener {
private final SailingServiceAsync sailingService;
private final ErrorReporter errorReporter;
private final StringMessages stringMessages;
@@ -51,8 +49,10 @@ public class RegattaStructureManagementPanel extends SimplePanel implements Rega
private RegattaListComposite regattaListComposite;
private RegattaDetailsComposite regattaDetailsComposite;
private final CaptionPanel regattasPanel;
public RegattaStructureManagementPanel(SailingServiceAsync sailingService, ErrorReporter errorReporter,
public RegattaManagementPanel(SailingServiceAsync sailingService, ErrorReporter errorReporter,
StringMessages stringMessages, RegattaRefresher regattaRefresher) {
this.sailingService = sailingService;
this.stringMessages = stringMessages;
@@ -63,6 +63,11 @@ public class RegattaStructureManagementPanel extends SimplePanel implements Rega
setWidget(mainPanel);
mainPanel.setWidth("100%");
regattasPanel = new CaptionPanel(stringMessages.regattas());
mainPanel.add(regattasPanel);
VerticalPanel regattasContentPanel = new VerticalPanel();
regattasPanel.setContentWidget(regattasContentPanel);
HorizontalPanel regattaManagementControlsPanel = new HorizontalPanel();
regattaManagementControlsPanel.setSpacing(5);
@@ -94,23 +99,19 @@ public class RegattaStructureManagementPanel extends SimplePanel implements Rega
}
});
regattaManagementControlsPanel.add(removeRegattaButton);
mainPanel.add(regattaManagementControlsPanel);
regattasContentPanel.add(regattaManagementControlsPanel);
Grid grid = new Grid(1 ,2);
mainPanel.add(grid);
regattaSelectionProvider = new RegattaSelectionModel(true);
regattaSelectionProvider.addRegattaSelectionChangeListener(this);
regattaListComposite = new RegattaListComposite(sailingService, regattaSelectionProvider, regattaRefresher, errorReporter, stringMessages);
regattaListComposite.ensureDebugId("RegattaListComposite");
grid.setWidget(0, 0, regattaListComposite);
grid.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_TOP);
grid.getColumnFormatter().getElement(1).getStyle().setPaddingTop(2.0, Unit.EM);
regattasContentPanel.add(regattaListComposite);
regattaDetailsComposite = new RegattaDetailsComposite(sailingService, regattaRefresher, errorReporter, stringMessages);
regattaDetailsComposite.ensureDebugId("RegattaDetailsComposite");
regattaDetailsComposite.setVisible(false);
grid.setWidget(0, 1, regattaDetailsComposite);
mainPanel.add(regattaDetailsComposite);
}
protected void removeRegattas(Collection<RegattaIdentifier> regattas) {
@@ -3,5 +3,7 @@ package com.sap.sailing.gwt.ui.adminconsole;
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
public interface TrackedRaceChangedListener {
void changeTrackingRace(Iterable<? extends RegattaAndRaceIdentifier> regattaAndRaceIdentifiers, boolean isTracked);
void racesStoppedTracking(Iterable<? extends RegattaAndRaceIdentifier> regattaAndRaceIdentifiers);
void racesRemoved(Iterable<? extends RegattaAndRaceIdentifier> regattaAndRaceIdentifiers);
}
@@ -72,7 +72,7 @@ public class TrackedRacesListComposite extends AbstractTrackedRacesListComposite
public void onSuccess(Void result) {
regattaRefresher.fillRegattas();
for (TrackedRaceChangedListener listener : raceIsTrackedRaceChangeListener) {
listener.changeTrackingRace(racesToStopTracking, false);
listener.racesStoppedTracking(racesToStopTracking);
}
}
}));
@@ -95,7 +95,7 @@ public class TrackedRacesListComposite extends AbstractTrackedRacesListComposite
public void onSuccess(Void result) {
regattaRefresher.fillRegattas();
for (TrackedRaceChangedListener listener : raceIsTrackedRaceChangeListener) {
listener.changeTrackingRace(regattaNamesAndRaceNames, false);
listener.racesRemoved(regattaNamesAndRaceNames);
}
}
}));
Loaded 100 of 133 files, more files were not shown because too many files have changed in this diff. Show more