mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-30 15:57:11 +00:00
remaining changes after merge
This commit is contained in:
1 parent
6abba47d29
commit
d2eb988050
21 files changed
+304
-101
No files matched your search
+16
-16
@@ -4,27 +4,27 @@ import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
|
||||
import com.sap.sailing.domain.base.CourseArea;
|
||||
import com.sap.sailing.domain.base.CourseData;
|
||||
import com.sap.sailing.domain.base.EventData;
|
||||
import com.sap.sailing.domain.base.CourseBase;
|
||||
import com.sap.sailing.domain.base.EventBase;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.racecommittee.app.domain.ManagedRace;
|
||||
|
||||
public interface DataStore {
|
||||
|
||||
public Collection<EventData> getEvents();
|
||||
public EventData getEvent(Serializable id);
|
||||
public boolean hasEvent(Serializable id);
|
||||
public void addEvent(EventData event);
|
||||
|
||||
public Collection<CourseArea> getCourseAreas(EventData event);
|
||||
public CourseArea getCourseArea(Serializable id);
|
||||
public boolean hasCourseArea(Serializable id);
|
||||
public void addCourseArea(EventData event, CourseArea courseArea);
|
||||
|
||||
public Collection<ManagedRace> getRaces();
|
||||
public void addRace(ManagedRace race);
|
||||
public ManagedRace getRace(Serializable id);
|
||||
public boolean hasRace(Serializable id);
|
||||
public Collection<EventBase> getEvents();
|
||||
public EventBase getEvent(Serializable id);
|
||||
public boolean hasEvent(Serializable id);
|
||||
public void addEvent(EventBase event);
|
||||
|
||||
public Collection<CourseArea> getCourseAreas(EventBase event);
|
||||
public CourseArea getCourseArea(Serializable id);
|
||||
public boolean hasCourseArea(Serializable id);
|
||||
public void addCourseArea(EventBase event, CourseArea courseArea);
|
||||
|
||||
public Collection<ManagedRace> getRaces();
|
||||
public void addRace(ManagedRace race);
|
||||
public ManagedRace getRace(Serializable id);
|
||||
public boolean hasRace(Serializable id);
|
||||
|
||||
public Collection<Mark> getMarks();
|
||||
public Mark getMark(Serializable id);
|
||||
|
||||
+67
-23
@@ -5,8 +5,8 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.sap.sailing.domain.base.CourseArea;
|
||||
import com.sap.sailing.domain.base.CourseData;
|
||||
import com.sap.sailing.domain.base.EventData;
|
||||
import com.sap.sailing.domain.base.CourseBase;
|
||||
import com.sap.sailing.domain.base.EventBase;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.racecommittee.app.domain.ManagedRace;
|
||||
import com.sap.sailing.racecommittee.app.utils.CollectionUtils;
|
||||
@@ -14,13 +14,19 @@ import com.sap.sailing.racecommittee.app.utils.CollectionUtils;
|
||||
public enum InMemoryDataStore implements DataStore {
|
||||
INSTANCE;
|
||||
|
||||
private HashMap<Serializable, EventData> eventsById;
|
||||
public Collection<EventBase> getEvents() {
|
||||
return eventsById.values();
|
||||
}
|
||||
private HashMap<Serializable, EventBase> eventsById;
|
||||
private HashMap<Serializable, ManagedRace> managedRaceById;
|
||||
private HashMap<Serializable, Mark> marksById;
|
||||
private CourseData courseData;
|
||||
private CourseBase courseData;
|
||||
|
||||
public EventBase getEvent(Serializable id) {
|
||||
return eventsById.get(id);
|
||||
}
|
||||
private InMemoryDataStore() {
|
||||
this.eventsById = new HashMap<Serializable, EventData>();
|
||||
this.eventsById = new HashMap<Serializable, EventBase>();
|
||||
this.managedRaceById = new HashMap<Serializable, ManagedRace>();
|
||||
this.marksById = new HashMap<Serializable, Mark>();
|
||||
this.courseData = null;
|
||||
@@ -32,34 +38,72 @@ public enum InMemoryDataStore implements DataStore {
|
||||
* * * * * *
|
||||
*/
|
||||
|
||||
public Collection<EventData> getEvents() {
|
||||
public Collection<EventBase> getEvents() {
|
||||
return eventsById.values();
|
||||
}
|
||||
public void addEvent(EventBase event) {
|
||||
eventsById.put(event.getId(), event);
|
||||
}
|
||||
|
||||
/*
|
||||
* * * * * * * *
|
||||
* COURSE AREA *
|
||||
* * * * * * * *
|
||||
*/
|
||||
|
||||
public EventData getEvent(Serializable id) {
|
||||
return eventsById.get(id);
|
||||
}
|
||||
public Collection<CourseArea> getCourseAreas(EventBase event) {
|
||||
if (event.getVenue() != null) {
|
||||
return CollectionUtils.newArrayList(event.getVenue().getCourseAreas());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean hasEvent(Serializable id) {
|
||||
return eventsById.containsKey(id);
|
||||
}
|
||||
public CourseArea getCourseArea(EventBase event, String name) {
|
||||
Collection<CourseArea> courseAreas = getCourseAreas(event);
|
||||
if (courseAreas != null) {
|
||||
for (CourseArea courseArea : courseAreas) {
|
||||
if (courseArea.getName().equals(name)) {
|
||||
return courseArea;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addEvent(EventData event) {
|
||||
eventsById.put(event.getId(), event);
|
||||
}
|
||||
public CourseArea getCourseArea(Serializable id) {
|
||||
for (EventBase event : eventsById.values()) {
|
||||
for (CourseArea courseArea : getCourseAreas(event)) {
|
||||
if (courseArea.getId().equals(id))
|
||||
return courseArea;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* * * * * * * *
|
||||
* COURSE AREA *
|
||||
* * * * * * * *
|
||||
*/
|
||||
public boolean hasCourseArea(Serializable id) {
|
||||
for (EventBase event : eventsById.values()) {
|
||||
for (CourseArea courseArea : getCourseAreas(event)) {
|
||||
if (courseArea.getId().equals(id))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Collection<CourseArea> getCourseAreas(EventData event) {
|
||||
if (event.getVenue() != null) {
|
||||
return CollectionUtils.newArrayList(event.getVenue().getCourseAreas());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public void addCourseArea(EventBase event, CourseArea courseArea) {
|
||||
if (event.getVenue() != null) {
|
||||
event.getVenue().addCourseArea(courseArea);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* * * * * * * *
|
||||
* MANAGED RACE *
|
||||
* * * * * * * *
|
||||
*/
|
||||
|
||||
public CourseArea getCourseArea(EventData event, String name) {
|
||||
Collection<CourseArea> courseAreas = getCourseAreas(event);
|
||||
|
||||
+37
-3
@@ -6,11 +6,11 @@ import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
import com.sap.sailing.domain.base.CourseArea;
|
||||
import com.sap.sailing.domain.base.EventData;
|
||||
import com.sap.sailing.domain.base.EventBase;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.base.impl.BoatClassImpl;
|
||||
import com.sap.sailing.domain.base.impl.CourseAreaImpl;
|
||||
import com.sap.sailing.domain.base.impl.EventDataImpl;
|
||||
import com.sap.sailing.domain.base.impl.EventBaseImpl;
|
||||
import com.sap.sailing.domain.base.impl.FleetImpl;
|
||||
import com.sap.sailing.domain.base.impl.MarkImpl;
|
||||
import com.sap.sailing.domain.base.impl.MillisecondsTimePoint;
|
||||
@@ -32,6 +32,40 @@ public class OfflineDataManager extends DataManager {
|
||||
|
||||
private static boolean isInitialized = false;
|
||||
|
||||
private void fillDataStore(DataStore dataStore) {
|
||||
dataStore.addEvent(new EventBaseImpl("Extreme Sailing Series 2012 (Cardiff)", "Cardiff", "", true, "DUMBUUIDA"));
|
||||
dataStore.addEvent(new EventBaseImpl("Extreme Sailing Series 2012 (Nice)", "Nice", "", true, "DUMBUUIDB"));
|
||||
dataStore.addEvent(new EventBaseImpl("Extreme Sailing Series 2012 (Rio)", "Rio", "", true, "DUMBUUIDC"));
|
||||
EventBase newEvent = new EventBaseImpl("Extreme Sailing Series 2013 (Muscat)", "Muscat", "", true, "FIXUUID");
|
||||
newEvent.getVenue().addCourseArea(new CourseAreaImpl("Offshore", "FIXCAUUID1"));
|
||||
newEvent.getVenue().addCourseArea(new CourseAreaImpl("Stadium", "FIXCAUUID2"));
|
||||
dataStore.addEvent(newEvent);
|
||||
|
||||
SeriesWithRows qualifying = new SeriesWithRowsImpl("Qualifying", false, null);
|
||||
SeriesWithRows medal = new SeriesWithRowsImpl("Medal", true, null);
|
||||
RaceGroup raceGroup = new RaceGroupImpl(
|
||||
"ESS",
|
||||
new BoatClassImpl("X40", false),
|
||||
null,
|
||||
Arrays.asList(qualifying, medal));
|
||||
|
||||
RaceLogEventFactory factory = new RaceLogEventFactoryImpl();
|
||||
PassAwareRaceLog log = new PassAwareRaceLogImpl();
|
||||
log.add(factory.createRaceStatusEvent(
|
||||
new MillisecondsTimePoint(new Date().getTime() + 1),
|
||||
2,
|
||||
RaceLogRaceStatus.SCHEDULED));
|
||||
|
||||
ManagedRace q1 = new ManagedRaceImpl(
|
||||
new ManagedRaceIdentifierImpl(
|
||||
"Q1",
|
||||
new FleetImpl("Default"),
|
||||
qualifying,
|
||||
raceGroup),
|
||||
log);
|
||||
|
||||
log = new PassAwareRaceLogImpl();
|
||||
/*log.add(factory.createStartTimeEvent(
|
||||
public OfflineDataManager(DataStore dataStore) {
|
||||
super(dataStore);
|
||||
|
||||
@@ -122,7 +156,7 @@ public class OfflineDataManager extends DataManager {
|
||||
dataStore.addMark(m3);
|
||||
}
|
||||
|
||||
public void loadEvents(LoadClient<Collection<EventData>> client) {
|
||||
public void loadEvents(LoadClient<Collection<EventBase>> client) {
|
||||
client.onLoadSucceded(dataStore.getEvents());
|
||||
}
|
||||
|
||||
|
||||
+64
-6
@@ -10,7 +10,7 @@ import android.content.Context;
|
||||
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
import com.sap.sailing.domain.base.CourseArea;
|
||||
import com.sap.sailing.domain.base.EventData;
|
||||
import com.sap.sailing.domain.base.EventBase;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.base.SharedDomainFactory;
|
||||
import com.sap.sailing.racecommittee.app.AppConstants;
|
||||
@@ -50,15 +50,47 @@ public class OnlineDataManager extends DataManager {
|
||||
|
||||
private Context context;
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void loadEvents(LoadClient<Collection<EventBase>> client) {
|
||||
if (dataStore.getEvents().isEmpty()) {
|
||||
reloadEvents(client);
|
||||
} else {
|
||||
client.onLoadSucceded(dataStore.getEvents());
|
||||
}
|
||||
}
|
||||
OnlineDataManager(Context context, DataStore dataStore) {
|
||||
super(dataStore);
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
public void addEvents(Collection<EventBase> events) {
|
||||
for (EventBase event : events) {
|
||||
dataStore.addEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
protected void reloadEvents(LoadClient<Collection<EventBase>> client) {
|
||||
DataParser<Collection<EventBase>> parser = new EventsDataParser(
|
||||
new EventDataJsonDeserializer(
|
||||
new VenueJsonDeserializer(
|
||||
new CourseAreaJsonDeserializer())));
|
||||
DataHandler<Collection<EventBase>> handler = new EventsDataHandler(this, client);
|
||||
|
||||
try {
|
||||
new DataLoader<Collection<EventBase>>(
|
||||
context,
|
||||
URI.create(AppConstants.getURL(context) + "/sailingserver/rc/events"),
|
||||
parser,
|
||||
handler).forceLoad();
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public void loadEvents(LoadClient<Collection<EventData>> client) {
|
||||
if (dataStore.getEvents().isEmpty()) {
|
||||
reloadEvents(client);
|
||||
@@ -67,8 +99,34 @@ public class OnlineDataManager extends DataManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void addEvents(Collection<EventData> events) {
|
||||
for (EventData event : events) {
|
||||
public void loadCourseAreas(
|
||||
final Serializable parentEventId,
|
||||
final LoadClient<Collection<CourseArea>> client) {
|
||||
|
||||
if (dataStore.hasEvent(parentEventId)) {
|
||||
EventBase event = dataStore.getEvent(parentEventId);
|
||||
client.onLoadSucceded(dataStore.getCourseAreas(event));
|
||||
} else {
|
||||
reloadEvents(new LoadClient<Collection<EventBase>>() {
|
||||
public void onLoadSucceded(Collection<EventBase> data) {
|
||||
if (dataStore.hasEvent(parentEventId)) {
|
||||
EventBase event = dataStore.getEvent(parentEventId);
|
||||
client.onLoadSucceded(dataStore.getCourseAreas(event));
|
||||
} else {
|
||||
client.onLoadFailed(new DataLoadingException(
|
||||
String.format("There was no event object found for id %s.", parentEventId)));
|
||||
}
|
||||
}
|
||||
|
||||
public void onLoadFailed(Exception reason) {
|
||||
client.onLoadFailed(new DataLoadingException(
|
||||
String.format("There was no event object found for id %s. While reloading the events an error occured: %s", parentEventId, reason), reason));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
public void addEvents(Collection<EventBase> events) {
|
||||
for (EventBase event : events) {
|
||||
dataStore.addEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
|
||||
import com.sap.sailing.domain.base.CourseArea;
|
||||
import com.sap.sailing.domain.base.EventData;
|
||||
import com.sap.sailing.domain.base.EventBase;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.racecommittee.app.data.clients.LoadClient;
|
||||
import com.sap.sailing.racecommittee.app.domain.ManagedRace;
|
||||
@@ -13,7 +13,7 @@ public interface ReadonlyDataManager {
|
||||
|
||||
public DataStore getDataStore();
|
||||
|
||||
public void loadEvents(LoadClient<Collection<EventData>> client);
|
||||
public void loadEvents(LoadClient<Collection<EventBase>> client);
|
||||
|
||||
public void loadCourseAreas(Serializable parentEventId, LoadClient<Collection<CourseArea>> client);
|
||||
|
||||
|
||||
+4
-4
@@ -2,18 +2,18 @@ package com.sap.sailing.racecommittee.app.data.handlers;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.sap.sailing.domain.base.EventData;
|
||||
import com.sap.sailing.domain.base.EventBase;
|
||||
import com.sap.sailing.racecommittee.app.data.OnlineDataManager;
|
||||
import com.sap.sailing.racecommittee.app.data.clients.LoadClient;
|
||||
|
||||
public class EventsDataHandler extends DataHandler<Collection<EventData>> {
|
||||
public class EventsDataHandler extends DataHandler<Collection<EventBase>> {
|
||||
|
||||
public EventsDataHandler(OnlineDataManager manager, LoadClient<Collection<EventData>> client) {
|
||||
public EventsDataHandler(OnlineDataManager manager, LoadClient<Collection<EventBase>> client) {
|
||||
super(manager, client);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoaded(Collection<EventData> data) {
|
||||
public void onLoaded(Collection<EventBase> data) {
|
||||
super.onLoaded(data);
|
||||
manager.addEvents(data);
|
||||
}
|
||||
|
||||
+19
-6
@@ -8,17 +8,30 @@ import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.JSONValue;
|
||||
|
||||
import com.sap.sailing.domain.base.EventData;
|
||||
import com.sap.sailing.domain.base.EventBase;
|
||||
import com.sap.sailing.server.gateway.deserialization.JsonDeserializer;
|
||||
import com.sap.sailing.server.gateway.deserialization.impl.Helpers;
|
||||
|
||||
public class EventsDataParser implements DataParser<Collection<EventData>> {
|
||||
public class EventsDataParser implements DataParser<Collection<EventBase>> {
|
||||
|
||||
private JsonDeserializer<EventData> deserializer;
|
||||
private JsonDeserializer<EventBase> deserializer;
|
||||
|
||||
public EventsDataParser(JsonDeserializer<EventBase> deserializer) {
|
||||
this.deserializer = deserializer;
|
||||
}
|
||||
|
||||
public EventsDataParser(JsonDeserializer<EventData> deserializer) {
|
||||
this.deserializer = deserializer;
|
||||
}
|
||||
public Collection<EventBase> parse(Reader reader) throws Exception {
|
||||
Object parsedResult = JSONValue.parse(reader);
|
||||
JSONArray jsonArray = Helpers.toJSONArraySafe(parsedResult);
|
||||
Collection<EventBase> events = new ArrayList<EventBase>();
|
||||
|
||||
for (Object element : jsonArray) {
|
||||
JSONObject json = Helpers.toJSONObjectSafe(element);
|
||||
events.add(deserializer.deserialize(json));
|
||||
}
|
||||
|
||||
return events;
|
||||
}
|
||||
|
||||
public Collection<EventData> parse(Reader reader) throws Exception {
|
||||
Object parsedResult = JSONValue.parseWithException(reader);
|
||||
|
||||
+5
-5
@@ -2,22 +2,22 @@ package com.sap.sailing.racecommittee.app.deserialization.impl;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import com.sap.sailing.domain.base.EventData;
|
||||
import com.sap.sailing.domain.base.EventBase;
|
||||
import com.sap.sailing.domain.base.Venue;
|
||||
import com.sap.sailing.domain.base.impl.EventDataImpl;
|
||||
import com.sap.sailing.domain.base.impl.EventBaseImpl;
|
||||
import com.sap.sailing.server.gateway.deserialization.JsonDeserializationException;
|
||||
import com.sap.sailing.server.gateway.deserialization.JsonDeserializer;
|
||||
import com.sap.sailing.server.gateway.deserialization.impl.Helpers;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.EventDataJsonSerializer;
|
||||
|
||||
public class EventDataJsonDeserializer implements JsonDeserializer<EventData> {
|
||||
public class EventDataJsonDeserializer implements JsonDeserializer<EventBase> {
|
||||
private JsonDeserializer<Venue> venueDeserializer;
|
||||
|
||||
public EventDataJsonDeserializer(JsonDeserializer<Venue> venueDeserializer) {
|
||||
this.venueDeserializer = venueDeserializer;
|
||||
}
|
||||
|
||||
public EventData deserialize(JSONObject object) throws JsonDeserializationException {
|
||||
public EventBase deserialize(JSONObject object) throws JsonDeserializationException {
|
||||
String id = object.get(EventDataJsonSerializer.FIELD_ID).toString();
|
||||
String name = object.get(EventDataJsonSerializer.FIELD_NAME).toString();
|
||||
String publicationUrl = object.get(EventDataJsonSerializer.FIELD_PUBLICATION_URL).toString();
|
||||
@@ -27,7 +27,7 @@ public class EventDataJsonDeserializer implements JsonDeserializer<EventData> {
|
||||
EventDataJsonSerializer.FIELD_VENUE);
|
||||
Venue venue = venueDeserializer.deserialize(venueObject);
|
||||
|
||||
return new EventDataImpl(
|
||||
return new EventBaseImpl(
|
||||
name,
|
||||
venue,
|
||||
publicationUrl,
|
||||
|
||||
+2
-2
@@ -3,14 +3,14 @@ package com.sap.sailing.racecommittee.app.domain;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.base.Fleet;
|
||||
import com.sap.sailing.domain.base.SeriesData;
|
||||
import com.sap.sailing.domain.base.SeriesBase;
|
||||
import com.sap.sailing.domain.base.racegroup.RaceGroup;
|
||||
|
||||
public interface FleetIdentifier {
|
||||
|
||||
public Fleet getFleet();
|
||||
|
||||
public SeriesData getSeries();
|
||||
public SeriesBase getSeries();
|
||||
|
||||
public RaceGroup getRaceGroup();
|
||||
|
||||
|
||||
+16
-4
@@ -3,15 +3,24 @@ package com.sap.sailing.racecommittee.app.domain.impl;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.base.Fleet;
|
||||
import com.sap.sailing.domain.base.SeriesData;
|
||||
import com.sap.sailing.domain.base.SeriesBase;
|
||||
import com.sap.sailing.domain.base.racegroup.RaceGroup;
|
||||
import com.sap.sailing.racecommittee.app.domain.FleetIdentifier;
|
||||
|
||||
public class FleetIdentifierImpl implements FleetIdentifier {
|
||||
|
||||
private Fleet fleet;
|
||||
private SeriesData series;
|
||||
private RaceGroup raceGroup;
|
||||
private Fleet fleet;
|
||||
private SeriesBase series;
|
||||
private RaceGroup raceGroup;
|
||||
|
||||
public FleetIdentifierImpl(
|
||||
Fleet fleet,
|
||||
SeriesBase series,
|
||||
RaceGroup raceGroup) {
|
||||
this.fleet = fleet;
|
||||
this.series = series;
|
||||
this.raceGroup = raceGroup;
|
||||
}
|
||||
|
||||
public FleetIdentifierImpl(Fleet fleet, SeriesData series, RaceGroup raceGroup) {
|
||||
this.fleet = fleet;
|
||||
@@ -19,6 +28,9 @@ public class FleetIdentifierImpl implements FleetIdentifier {
|
||||
this.raceGroup = raceGroup;
|
||||
}
|
||||
|
||||
public SeriesBase getSeries() {
|
||||
return series;
|
||||
}
|
||||
public Fleet getFleet() {
|
||||
return fleet;
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.sap.sailing.racecommittee.app.domain.impl;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.base.Fleet;
|
||||
import com.sap.sailing.domain.base.SeriesData;
|
||||
import com.sap.sailing.domain.base.SeriesBase;
|
||||
import com.sap.sailing.domain.base.racegroup.RaceGroup;
|
||||
import com.sap.sailing.racecommittee.app.domain.FleetIdentifier;
|
||||
import com.sap.sailing.racecommittee.app.domain.ManagedRaceIdentifier;
|
||||
@@ -15,7 +15,7 @@ public class ManagedRaceIdentifierImpl extends FleetIdentifierImpl implements Ma
|
||||
public ManagedRaceIdentifierImpl(
|
||||
String raceName,
|
||||
Fleet fleetWithRaceNames,
|
||||
SeriesData series,
|
||||
SeriesBase series,
|
||||
RaceGroup raceGroup) {
|
||||
super(fleetWithRaceNames, series, raceGroup);
|
||||
this.raceName = raceName;
|
||||
|
||||
+4
-1
@@ -4,7 +4,7 @@ import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.base.CourseData;
|
||||
import com.sap.sailing.domain.base.Fleet;
|
||||
import com.sap.sailing.domain.base.SeriesData;
|
||||
import com.sap.sailing.domain.base.SeriesBase;
|
||||
import com.sap.sailing.domain.base.racegroup.RaceGroup;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sailing.domain.racelog.PassAwareRaceLog;
|
||||
@@ -33,6 +33,9 @@ public class ManagedRaceImpl implements ManagedRace {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public SeriesBase getSeries() {
|
||||
return identifier.getSeries();
|
||||
}
|
||||
public Serializable getId() {
|
||||
return identifier.getId();
|
||||
}
|
||||
|
||||
+40
-1
@@ -11,7 +11,7 @@ import android.view.Window;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.sap.sailing.domain.base.CourseArea;
|
||||
import com.sap.sailing.domain.base.EventData;
|
||||
import com.sap.sailing.domain.base.EventBase;
|
||||
import com.sap.sailing.racecommittee.app.AppConstants;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
import com.sap.sailing.racecommittee.app.logging.ExLog;
|
||||
@@ -50,6 +50,34 @@ public class LoginActivity extends TwoPaneActivity implements EventSelectedListe
|
||||
}
|
||||
}
|
||||
|
||||
private void addEventListFragment() {
|
||||
FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
||||
transaction.add(R.id.leftContainer, new EventListFragment());
|
||||
transaction.setTransition(FragmentTransaction.TRANSIT_NONE);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
private void addCourseAreaListFragment(Serializable eventId) {
|
||||
Bundle args = new Bundle();
|
||||
args.putSerializable(AppConstants.EventIdTag, eventId);
|
||||
|
||||
Fragment fragment = new CourseAreaListFragment();
|
||||
fragment.setArguments(args);
|
||||
FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
||||
transaction.setCustomAnimations(R.animator.slide_in, R.animator.slide_out);
|
||||
transaction.replace(R.id.rightContainer, fragment);
|
||||
transaction.commit();
|
||||
ExLog.i("LoginActivity", "CourseFragment created.");
|
||||
}
|
||||
|
||||
private ItemSelectedListener<EventBase> eventSelectionListener = new ItemSelectedListener<EventBase>() {
|
||||
|
||||
public void itemSelected(Fragment sender, EventBase event) {
|
||||
Serializable eventId = event.getId();
|
||||
ExLog.i(ExLog.EVENT_SELECTED, eventId.toString(), getBaseContext());
|
||||
showCourseAreaListFragment(eventId);
|
||||
}
|
||||
};
|
||||
// Login -> startRaceActivity(selectedCourse);
|
||||
|
||||
private void addEventListFragment() {
|
||||
@@ -58,6 +86,17 @@ public class LoginActivity extends TwoPaneActivity implements EventSelectedListe
|
||||
transaction.setTransition(FragmentTransaction.TRANSIT_NONE);
|
||||
transaction.commit();
|
||||
}
|
||||
public ItemSelectedListener<EventBase> getEventSelectionListener() {
|
||||
return eventSelectionListener;
|
||||
}
|
||||
|
||||
private void showCourseAreaListFragment(Serializable eventId) {
|
||||
Toast.makeText(LoginActivity.this, eventId.toString(), Toast.LENGTH_LONG).show();
|
||||
getRightLayout().setVisibility(View.VISIBLE);
|
||||
addCourseAreaListFragment(eventId);
|
||||
}
|
||||
|
||||
private ItemSelectedListener<CourseArea> courseAreaSelectionListener = new ItemSelectedListener<CourseArea>() {
|
||||
|
||||
private void addCourseAreaListFragment(Serializable eventId) {
|
||||
Bundle args = new Bundle();
|
||||
|
||||
+4
-4
@@ -2,15 +2,15 @@ package com.sap.sailing.racecommittee.app.ui.adapters.racelist;
|
||||
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
import com.sap.sailing.domain.base.Fleet;
|
||||
import com.sap.sailing.domain.base.SeriesData;
|
||||
import com.sap.sailing.domain.base.SeriesBase;
|
||||
|
||||
public class BoatClassSeriesDataFleet {
|
||||
|
||||
private BoatClass boatClass;
|
||||
private SeriesData series;
|
||||
private SeriesBase series;
|
||||
private Fleet fleet;
|
||||
|
||||
public BoatClassSeriesDataFleet(BoatClass boatClass, SeriesData series, Fleet fleet) {
|
||||
public BoatClassSeriesDataFleet(BoatClass boatClass, SeriesBase series, Fleet fleet) {
|
||||
this.boatClass = boatClass;
|
||||
this.series = series;
|
||||
this.fleet = fleet;
|
||||
@@ -32,7 +32,7 @@ public class BoatClassSeriesDataFleet {
|
||||
return boatClass;
|
||||
}
|
||||
|
||||
public SeriesData getSeries() {
|
||||
public SeriesBase getSeries() {
|
||||
return series;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ package com.sap.sailing.racecommittee.app.ui.adapters.racelist;
|
||||
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
import com.sap.sailing.domain.base.Fleet;
|
||||
import com.sap.sailing.domain.base.SeriesData;
|
||||
import com.sap.sailing.domain.base.SeriesBase;
|
||||
|
||||
public class RaceListDataTypeTitle extends RaceListDataType {
|
||||
|
||||
@@ -20,7 +20,7 @@ public class RaceListDataTypeTitle extends RaceListDataType {
|
||||
return data.getBoatClass();
|
||||
}
|
||||
|
||||
public SeriesData getSeries() {
|
||||
public SeriesBase getSeries() {
|
||||
return data.getSeries();
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -2,13 +2,13 @@ package com.sap.sailing.racecommittee.app.ui.fragments.lists;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.sap.sailing.domain.base.EventData;
|
||||
import com.sap.sailing.domain.base.EventBase;
|
||||
import com.sap.sailing.racecommittee.app.R;
|
||||
import com.sap.sailing.racecommittee.app.data.ReadonlyDataManager;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.lists.selection.EventSelectedListenerHost;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.lists.selection.ItemSelectedListener;
|
||||
|
||||
public class EventListFragment extends NamedListFragment<EventData> {
|
||||
public class EventListFragment extends NamedListFragment<EventBase> {
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
@@ -17,7 +17,7 @@ public class EventListFragment extends NamedListFragment<EventData> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemSelectedListener<EventData> attachListener(Activity activity) {
|
||||
protected ItemSelectedListener<EventBase> attachListener(Activity activity) {
|
||||
if (activity instanceof EventSelectedListenerHost) {
|
||||
EventSelectedListenerHost listener = (EventSelectedListenerHost) activity;
|
||||
return listener.getEventSelectionListener();
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package com.sap.sailing.racecommittee.app.ui.fragments.lists.selection;
|
||||
|
||||
import com.sap.sailing.domain.base.EventData;
|
||||
import com.sap.sailing.domain.base.EventBase;
|
||||
|
||||
public interface EventSelectedListenerHost {
|
||||
public ItemSelectedListener<EventData> getEventSelectionListener();
|
||||
public ItemSelectedListener<EventBase> getEventSelectionListener();
|
||||
}
|
||||
Reference in new issue
Block a user