Moved dom to shared package/ implemented initial partially dummy service

This commit is contained in:
Papick Garcia Taboada committed 2015-02-25 16:53:28 +01:00
1 parent 10978df3de
commit beb4dfb87f
15 files changed
+100 -87

No files matched your search

@@ -5,11 +5,11 @@ import com.google.gwt.place.shared.Place;
import com.sap.sailing.gwt.common.client.controls.tabbar.TabView;
import com.sap.sailing.gwt.home.client.place.event.EventClientFactory;
import com.sap.sailing.gwt.home.client.place.event2.EventView.PlaceCallback;
import com.sap.sailing.gwt.home.client.place.event2.model.EventMetadataDTO;
import com.sap.sailing.gwt.home.client.place.event2.model.EventReferenceDTO;
import com.sap.sailing.gwt.home.client.place.event2.model.EventType;
import com.sap.sailing.gwt.home.client.place.event2.model.RegattaReferenceDTO;
import com.sap.sailing.gwt.home.client.place.event2.regatta.tabs.RegattaOverviewPlace;
import com.sap.sailing.gwt.ui.shared.eventview.EventMetadataDTO;
import com.sap.sailing.gwt.ui.shared.eventview.EventReferenceDTO;
import com.sap.sailing.gwt.ui.shared.eventview.EventType;
import com.sap.sailing.gwt.ui.shared.eventview.RegattaReferenceDTO;
public abstract class EventActivity<PLACE extends AbstractEventPlace> extends AbstractActivity implements EventView.Presenter {
@@ -1,21 +1,18 @@
package com.sap.sailing.gwt.home.client.place.event2;
import java.util.Date;
import java.util.UUID;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sap.sailing.gwt.home.client.place.event.EventClientFactory;
import com.sap.sailing.gwt.home.client.place.event2.model.EventMetadataDTO;
import com.sap.sailing.gwt.home.client.place.event2.model.EventReferenceDTO;
import com.sap.sailing.gwt.home.client.place.event2.model.EventType;
import com.sap.sailing.gwt.home.client.place.event2.model.RegattaReferenceDTO;
import com.sap.sailing.gwt.home.client.place.event2.model.EventState;
import com.sap.sailing.gwt.home.client.place.event2.multiregatta.AbstractMultiregattaEventPlace;
import com.sap.sailing.gwt.home.client.place.event2.multiregatta.EventMultiregattaActivity;
import com.sap.sailing.gwt.home.client.place.event2.multiregatta.tabs.MultiregattaOverviewPlace;
import com.sap.sailing.gwt.home.client.place.event2.regatta.AbstractEventRegattaPlace;
import com.sap.sailing.gwt.home.client.place.event2.regatta.EventRegattaActivity;
import com.sap.sailing.gwt.home.client.place.event2.regatta.tabs.RegattaOverviewPlace;
import com.sap.sailing.gwt.ui.shared.eventview.EventMetadataDTO;
import com.sap.sailing.gwt.ui.shared.eventview.EventType;
import com.sap.sse.gwt.client.mvp.AbstractActivityProxy;
public class EventActivityProxy extends AbstractActivityProxy {
@@ -30,7 +27,6 @@ public class EventActivityProxy extends AbstractActivityProxy {
this.clientFactory = clientFactory;
}
@SuppressWarnings("deprecation")
@Override
protected void startAsync() {
if (ctx.getEventDTO() != null) {
@@ -38,63 +34,24 @@ public class EventActivityProxy extends AbstractActivityProxy {
} else {
final UUID eventUUID = UUID.fromString(ctx.getEventId());
EventMetadataDTO event = new EventMetadataDTO();
event.setId(eventUUID);
event.setName("Kieler Woche");
event.setVenue("Kiel");
event.setVenueCountry("Germany");
event.setStartDate(new Date(115, 6, 10));
event.setEndDate(new Date(115, 6, 12));
event.setOfficialWebsiteURL("http://sapsailing.com");
event.setState(EventState.UPCOMMING);
clientFactory.getSailingService().getEventMetadataById(eventUUID, new AsyncCallback<EventMetadataDTO>() {
@Override
public void onSuccess(final EventMetadataDTO event) {
if (event != null) {
ctx.updateContext(event);
afterLoad();
} else {
// TODO
// createErrorView("No such event with UUID " + eventUUID, null, panel);
}
}
// event.setType(EventType.SINGLE_REGATTA);
event.setType(EventType.MULTI_REGATTA);
// event.setType(EventType.SERIES_EVENT);
switch (event.getType()) {
case SINGLE_REGATTA:
event.getRegattas().add(new RegattaReferenceDTO("Regatta"));
break;
case MULTI_REGATTA:
event.getRegattas().add(new RegattaReferenceDTO("Regatta 1"));
event.getRegattas().add(new RegattaReferenceDTO("Regatta 2"));
event.getRegattas().add(new RegattaReferenceDTO("Regatta 3"));
break;
case SERIES_EVENT:
event.getRegattas().add(new RegattaReferenceDTO("Regatta"));
event.getEventsOfSeries().add(new EventReferenceDTO(eventUUID, "Series Event 1", "Regatta 1"));
event.getEventsOfSeries().add(
new EventReferenceDTO(UUID.fromString("212385a0-fff7-432a-a63f-df2420faefc4"),
"Series Event 2", "Regatta 2"));
event.getEventsOfSeries().add(
new EventReferenceDTO(UUID.fromString("312385a0-fff7-432a-a63f-df2420faefc4"),
"Series Event 3", "Regatta 3"));
break;
}
ctx.updateContext(event);
afterLoad();
// clientFactory.getSailingService().getEventById(eventUUID, true, new AsyncCallback<EventDTO>() {
// @Override
// public void onSuccess(final EventDTO event) {
// if(event != null) {
// ctx.updateContext(event);
// afterLoad();
// } else {
// // TODO
//// createErrorView("No such event with UUID " + eventUUID, null, panel);
// }
// }
//
// @Override
// public void onFailure(Throwable caught) {
// // TODO
//// createErrorView("Error while loading the event with service getEventById()", caught, panel);
// }
// });
@Override
public void onFailure(Throwable caught) {
// TODO
// createErrorView("Error while loading the event with service getEventById()", caught, panel);
}
});
}
@@ -1,6 +1,6 @@
package com.sap.sailing.gwt.home.client.place.event2;
import com.sap.sailing.gwt.home.client.place.event2.model.EventMetadataDTO;
import com.sap.sailing.gwt.ui.shared.eventview.EventMetadataDTO;
/**
* Common context used by the different tabs in the event place.
@@ -28,10 +28,10 @@ import com.sap.sailing.gwt.home.client.place.event2.AbstractEventPlace;
import com.sap.sailing.gwt.home.client.place.event2.EventView;
import com.sap.sailing.gwt.home.client.place.event2.EventView.PlaceCallback;
import com.sap.sailing.gwt.home.client.place.event2.EventView.Presenter;
import com.sap.sailing.gwt.home.client.place.event2.model.EventMetadataDTO;
import com.sap.sailing.gwt.home.client.place.event2.model.EventState;
import com.sap.sailing.gwt.home.client.shared.EventDatesFormatterUtil;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.shared.eventview.EventMetadataDTO;
import com.sap.sailing.gwt.ui.shared.eventview.EventState;
public class EventHeader extends Composite {
private static EventHeaderUiBinder uiBinder = GWT.create(EventHeaderUiBinder.class);
@@ -11,12 +11,12 @@ import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.PushButton;
import com.sap.sailing.gwt.home.client.place.event2.EventContext;
import com.sap.sailing.gwt.home.client.place.event2.model.EventMetadataDTO;
import com.sap.sailing.gwt.home.client.place.event2.model.RegattaReferenceDTO;
import com.sap.sailing.gwt.home.client.place.event2.multiregatta.EventMultiregattaView;
import com.sap.sailing.gwt.home.client.place.event2.multiregatta.EventMultiregattaView.Presenter;
import com.sap.sailing.gwt.home.client.place.event2.multiregatta.MultiregattaTabView;
import com.sap.sailing.gwt.home.client.place.event2.regatta.tabs.RegattaOverviewPlace;
import com.sap.sailing.gwt.ui.shared.eventview.EventMetadataDTO;
import com.sap.sailing.gwt.ui.shared.eventview.RegattaReferenceDTO;
/**
* Created by pgtaboada on 25.11.14.
@@ -4,9 +4,9 @@ import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.sap.sailing.gwt.home.client.place.event.EventClientFactory;
import com.sap.sailing.gwt.home.client.place.event2.EventActivity;
import com.sap.sailing.gwt.home.client.place.event2.model.EventMetadataDTO;
import com.sap.sailing.gwt.home.client.place.event2.model.EventType;
import com.sap.sailing.gwt.home.client.place.event2.regatta.tabs.RegattaOverviewPlace;
import com.sap.sailing.gwt.ui.shared.eventview.EventMetadataDTO;
import com.sap.sailing.gwt.ui.shared.eventview.EventType;
public class EventRegattaActivity extends EventActivity<AbstractEventRegattaPlace> implements EventRegattaView.Presenter {
@@ -15,8 +15,6 @@ import com.sap.sailing.gwt.home.client.app.ApplicationHistoryMapper;
import com.sap.sailing.gwt.home.client.place.event2.EventContext;
import com.sap.sailing.gwt.home.client.place.event2.EventDefaultPlace;
import com.sap.sailing.gwt.home.client.place.event2.header.EventHeader;
import com.sap.sailing.gwt.home.client.place.event2.model.EventType;
import com.sap.sailing.gwt.home.client.place.event2.regatta.tabs.RegattaOverviewPlace;
import com.sap.sailing.gwt.home.client.place.events.EventsPlace;
import com.sap.sailing.gwt.home.client.place.start.StartPlace;
import com.sap.sailing.gwt.ui.client.StringMessages;
@@ -67,6 +65,7 @@ public class TabletAndDesktopEventView extends Composite implements EventRegatta
tabPanelUi.activatePlace(place);
}
@SuppressWarnings("unchecked")
@UiHandler("tabPanelUi")
public void onTabSelection(TabPanelPlaceSelectionEvent<?> e) {
currentPresenter.handleTabPlaceSelection((TabView<?, EventRegattaView.Presenter>) e.getSelectedActivity());
@@ -75,10 +74,9 @@ public class TabletAndDesktopEventView extends Composite implements EventRegatta
private void initBreadCrumbs() {
addBreadCrumbItem(i18n.home(), new StartPlace());
addBreadCrumbItem(i18n.events(), new EventsPlace());
addBreadCrumbItem(currentPresenter.getCtx().getEventDTO().getName(), new EventDefaultPlace(currentPresenter.getCtx()));
if(currentPresenter.getCtx().getEventDTO().getType() == EventType.MULTI_REGATTA) {
addBreadCrumbItem(currentPresenter.getCtx().getRegattaId(), new RegattaOverviewPlace(currentPresenter.getCtx()));
}
addBreadCrumbItem(currentPresenter.getCtx().getEventDTO().getName(),
new EventDefaultPlace(currentPresenter.getCtx()));
// TODO additional item for multi Regatta
}
private void addBreadCrumbItem(String label, final Place place) {
@@ -84,6 +84,7 @@ import com.sap.sailing.gwt.ui.shared.TrackFileImportDeviceIdentifierDTO;
import com.sap.sailing.gwt.ui.shared.VenueDTO;
import com.sap.sailing.gwt.ui.shared.WindDTO;
import com.sap.sailing.gwt.ui.shared.WindInfoForRaceDTO;
import com.sap.sailing.gwt.ui.shared.eventview.EventMetadataDTO;
import com.sap.sse.common.NoCorrespondingServiceRegisteredException;
import com.sap.sse.common.Util;
import com.sap.sse.common.Util.Pair;
@@ -573,4 +574,7 @@ public interface SailingService extends RemoteService, FileStorageManagementGwtS
List<DeviceMappingDTO> getDeviceMappingsFromLogHierarchy(String leaderboardName, String raceColumnName,
String fleetName) throws TransformationException;
EventMetadataDTO getEventMetadataById(UUID id);
}
@@ -74,6 +74,7 @@ import com.sap.sailing.gwt.ui.shared.TrackFileImportDeviceIdentifierDTO;
import com.sap.sailing.gwt.ui.shared.VenueDTO;
import com.sap.sailing.gwt.ui.shared.WindDTO;
import com.sap.sailing.gwt.ui.shared.WindInfoForRaceDTO;
import com.sap.sailing.gwt.ui.shared.eventview.EventMetadataDTO;
import com.sap.sse.common.Util;
import com.sap.sse.common.search.KeywordQuery;
import com.sap.sse.gwt.client.BuildVersionRetriever;
@@ -684,4 +685,6 @@ public interface SailingServiceAsync extends BuildVersionRetriever, FileStorageM
void createRegattaStructure(Iterable<RegattaDTO> regattaNames,
EventDTO newEvent, AsyncCallback<Void> asyncCallback);
void getEventMetadataById(UUID id, AsyncCallback<EventMetadataDTO> callback);
}
@@ -330,6 +330,11 @@ import com.sap.sailing.gwt.ui.shared.WaypointDTO;
import com.sap.sailing.gwt.ui.shared.WindDTO;
import com.sap.sailing.gwt.ui.shared.WindInfoForRaceDTO;
import com.sap.sailing.gwt.ui.shared.WindTrackInfoDTO;
import com.sap.sailing.gwt.ui.shared.eventview.EventMetadataDTO;
import com.sap.sailing.gwt.ui.shared.eventview.EventReferenceDTO;
import com.sap.sailing.gwt.ui.shared.eventview.EventState;
import com.sap.sailing.gwt.ui.shared.eventview.EventType;
import com.sap.sailing.gwt.ui.shared.eventview.RegattaReferenceDTO;
import com.sap.sailing.manage2sail.EventResultDescriptor;
import com.sap.sailing.manage2sail.Manage2SailEventResultsParserImpl;
import com.sap.sailing.manage2sail.RaceResultDescriptor;
@@ -5486,4 +5491,48 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
return null;
}
}
@Override
public EventMetadataDTO getEventMetadataById(UUID id) {
EventDTO o;
try {
o = getEventById(id, false);
} catch (MalformedURLException e) {
throw new RuntimeException("We can do better than MalformedURLException");
}
EventMetadataDTO dto = new EventMetadataDTO();
dto.setId(id);
dto.setStartDate(o.startDate);
dto.setEndDate(o.endDate);
dto.setLogoImageURL(o.getLogoImageURL());
dto.setName(o.getName());
dto.setOfficialWebsiteURL(o.getOfficialWebsiteURL());
dto.setVenue(o.venue.getName());
dto.setVenueCountry(null);
dto.setState(EventState.FINISHED);
if (o.isFakeSeries()) {
dto.setType(EventType.SERIES_EVENT);
dto.getEventsOfSeries().add(new EventReferenceDTO(id, o.getName()));
// FIXME
dto.getEventsOfSeries().add(
new EventReferenceDTO(UUID.fromString("212385a0-fff7-432a-a63f-df2420faefc4"),
"Series Event 2"));
dto.getEventsOfSeries().add(
new EventReferenceDTO(UUID.fromString("312385a0-fff7-432a-a63f-df2420faefc4"),
"Series Event 3"));
} else {
for (LeaderboardGroupDTO lg : o.getLeaderboardGroups()) {
for (StrippedLeaderboardDTO sl : lg.leaderboards) {
dto.getRegattas().add(new RegattaReferenceDTO(sl.regattaName));
}
dto.setType(dto.getRegattas().size() == 1 ? EventType.SINGLE_REGATTA: EventType.MULTI_REGATTA);
}
}
return dto;
}
}
@@ -1,4 +1,4 @@
package com.sap.sailing.gwt.home.client.place.event2.model;
package com.sap.sailing.gwt.ui.shared.eventview;
import java.util.ArrayList;
import java.util.Date;
@@ -1,4 +1,4 @@
package com.sap.sailing.gwt.home.client.place.event2.model;
package com.sap.sailing.gwt.ui.shared.eventview;
import java.util.UUID;
@@ -10,7 +10,7 @@ public class EventReferenceDTO implements IsSerializable {
public EventReferenceDTO() {
}
public EventReferenceDTO(UUID id, String name, String regattaName) {
public EventReferenceDTO(UUID id, String name) {
super();
this.id = id;
this.displayName = name;
@@ -1,4 +1,4 @@
package com.sap.sailing.gwt.home.client.place.event2.model;
package com.sap.sailing.gwt.ui.shared.eventview;
public enum EventState {
UPCOMMING,
@@ -1,4 +1,4 @@
package com.sap.sailing.gwt.home.client.place.event2.model;
package com.sap.sailing.gwt.ui.shared.eventview;
public enum EventType {
SINGLE_REGATTA,
@@ -1,6 +1,8 @@
package com.sap.sailing.gwt.home.client.place.event2.model;
package com.sap.sailing.gwt.ui.shared.eventview;
public class RegattaReferenceDTO {
import com.google.gwt.user.client.rpc.IsSerializable;
public class RegattaReferenceDTO implements IsSerializable {
private String name;
public RegattaReferenceDTO() {