mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-17 01:31:01 +00:00
fixed regatta detail navigation and compact header navigation for event page
This commit is contained in:
1 parent
be35bff802
commit
0a9aa35e71
10 files changed
+74
-51
No files matched your search
+2
-1
@@ -7,6 +7,7 @@ import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.google.gwt.place.shared.Place;
|
||||
import com.sap.sailing.gwt.ui.client.URLEncoder;
|
||||
|
||||
/**
|
||||
* An abstract Place which is able to manage and parse place parameters.
|
||||
@@ -33,7 +34,7 @@ public abstract class AbstractBasePlace extends Place {
|
||||
if(stringBuilder.length() > 0) {
|
||||
stringBuilder.append("&");
|
||||
}
|
||||
stringBuilder.append(paramName + "=" + paramValue);
|
||||
stringBuilder.append(paramName + "=" + URLEncoder.encode(paramValue));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -36,4 +36,10 @@ public abstract class AbstractPlaceNavigator implements PlaceNavigator {
|
||||
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);
|
||||
}
|
||||
}
|
||||
+9
@@ -52,6 +52,15 @@ 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());
|
||||
|
||||
+13
-23
@@ -6,11 +6,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.History;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
@@ -55,6 +52,9 @@ public class TabletAndDesktopEventView extends Composite implements EventView, E
|
||||
private final List<Widget> pageElements;
|
||||
private final EventDTO event;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private EventPlace currentInternalPlace;
|
||||
|
||||
public TabletAndDesktopEventView(SailingServiceAsync sailingService, EventDTO event, List<RaceGroupDTO> raceGroups, String leaderboardName,
|
||||
Timer timerForClientServerOffset, HomePlacesNavigator navigator) {
|
||||
this.event = event;
|
||||
@@ -103,47 +103,42 @@ public class TabletAndDesktopEventView extends Composite implements EventView, E
|
||||
@Override
|
||||
public void goToOverview() {
|
||||
setVisibleEventElement(eventOverview);
|
||||
eventHeader.setDataNavigationType("normal");
|
||||
eventHeader.setFullsizeHeader();
|
||||
|
||||
EventPlace place = new EventPlace(event.id.toString(), NavigationTabs.Overview, null);
|
||||
pushPlaceToHistoryStack(place, new EventPlace.Tokenizer());
|
||||
currentInternalPlace = new EventPlace(event.id.toString(), NavigationTabs.Overview, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void goToRegattas() {
|
||||
setVisibleEventElement(eventRegattaList);
|
||||
eventHeader.setDataNavigationType("normal");
|
||||
eventHeader.setFullsizeHeader();
|
||||
|
||||
EventPlace place = new EventPlace(event.id.toString(), NavigationTabs.Regattas, null);
|
||||
pushPlaceToHistoryStack(place, new EventPlace.Tokenizer());
|
||||
currentInternalPlace = new EventPlace(event.id.toString(), NavigationTabs.Regattas, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void goToRegattaRaces(LeaderboardGroupDTO leaderboardGroup, StrippedLeaderboardDTO leaderboard, RaceGroupDTO raceGroup) {
|
||||
eventRegattaRaces.setRaces(leaderboardGroup, false, leaderboard, raceGroup);
|
||||
eventHeader.setDataNavigationType("compact");
|
||||
eventHeader.setCompactHeader();
|
||||
setVisibleEventElement(eventRegattaRaces);
|
||||
|
||||
EventPlace place = new EventPlace(event.id.toString(), NavigationTabs.Regatta, leaderboard.name);
|
||||
pushPlaceToHistoryStack(place, new EventPlace.Tokenizer());
|
||||
currentInternalPlace = new EventPlace(event.id.toString(), NavigationTabs.Regatta, leaderboard.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void goToSchedule() {
|
||||
setVisibleEventElement(eventSchedule);
|
||||
eventHeader.setDataNavigationType("normal");
|
||||
eventHeader.setFullsizeHeader();
|
||||
|
||||
EventPlace place = new EventPlace(event.id.toString(), NavigationTabs.Schedule, null);
|
||||
pushPlaceToHistoryStack(place, new EventPlace.Tokenizer());
|
||||
currentInternalPlace = new EventPlace(event.id.toString(), NavigationTabs.Schedule, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void goToMedia() {
|
||||
setVisibleEventElement(eventMedia);
|
||||
eventHeader.setDataNavigationType("normal");
|
||||
eventHeader.setFullsizeHeader();
|
||||
|
||||
EventPlace place = new EventPlace(event.id.toString(), NavigationTabs.Media, null);
|
||||
pushPlaceToHistoryStack(place, new EventPlace.Tokenizer());
|
||||
currentInternalPlace = new EventPlace(event.id.toString(), NavigationTabs.Media, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -226,10 +221,5 @@ public class TabletAndDesktopEventView extends Composite implements EventView, E
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private <T extends Place> void pushPlaceToHistoryStack(T destinationPlace, PlaceTokenizer<T> tokenizer) {
|
||||
String placeHistoryToken = destinationPlace.getClass().getSimpleName() + ":" + tokenizer.getToken(destinationPlace);
|
||||
History.newItem(placeHistoryToken, false);
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -11,10 +11,10 @@
|
||||
<div class="{local_res.css.eventnavigation} {local_res.css.eventnavigationcompact}">
|
||||
<div class="{res.mainCss.grid}">
|
||||
<div class="{res.mediaCss.columns}">
|
||||
<g:Anchor href="javascript:;" ui:field="regattaLink">
|
||||
<g:Anchor ui:field="regattaLink">
|
||||
<img ui:field="eventLogo" alt="" height="41" width="41" class="{local_res.css.eventnavigationcompact_logo}"></img>
|
||||
</g:Anchor>
|
||||
<g:Anchor href="javascript:;" ui:field="regattaLink2" styleName="{res.mainCss.button} {local_res.css.eventnavigation_link}">
|
||||
<g:Anchor ui:field="regattaLink2" styleName="{res.mainCss.button} {local_res.css.eventnavigation_link}">
|
||||
<span ui:field='eventNameSpan' />
|
||||
</g:Anchor>
|
||||
</div>
|
||||
|
||||
+20
-8
@@ -4,8 +4,8 @@ import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.DivElement;
|
||||
import com.google.gwt.dom.client.ImageElement;
|
||||
import com.google.gwt.dom.client.SpanElement;
|
||||
import com.google.gwt.dom.client.StyleInjector;
|
||||
import com.google.gwt.dom.client.Style.Display;
|
||||
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;
|
||||
@@ -17,6 +17,7 @@ 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.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.shared.EventDatesFormatterUtil;
|
||||
@@ -95,7 +96,7 @@ public class EventHeader extends AbstractEventComposite {
|
||||
isLiveDiv.getStyle().setDisplay(Display.NONE);
|
||||
}
|
||||
|
||||
setDataNavigationType("normal");
|
||||
setFullsizeHeader();
|
||||
updateUI();
|
||||
}
|
||||
|
||||
@@ -108,7 +109,7 @@ public class EventHeader extends AbstractEventComposite {
|
||||
isFinishedDiv.getStyle().setDisplay(Display.NONE);
|
||||
isLiveDiv.getStyle().setDisplay(Display.NONE);
|
||||
|
||||
setDataNavigationType("normal");
|
||||
setFullsizeHeader();
|
||||
updateUI();
|
||||
}
|
||||
|
||||
@@ -118,9 +119,18 @@ public class EventHeader extends AbstractEventComposite {
|
||||
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
public void setFullsizeHeader() {
|
||||
eventHeaderWrapperDiv.setAttribute("data-navigationtype", "normal");
|
||||
}
|
||||
|
||||
public void setDataNavigationType(String dataNavigationType) {
|
||||
eventHeaderWrapperDiv.setAttribute("data-navigationtype", dataNavigationType);
|
||||
public void setCompactHeader() {
|
||||
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());
|
||||
}
|
||||
|
||||
private StrippedLeaderboardDTO findLeaderboardWithSameCourseArea(EventDTO event) {
|
||||
@@ -223,12 +233,12 @@ public class EventHeader extends AbstractEventComposite {
|
||||
|
||||
@UiHandler("regattasLink")
|
||||
void regattasClicked(ClickEvent event) {
|
||||
showRegattas();
|
||||
showRegattas(event);
|
||||
}
|
||||
|
||||
@UiHandler("regattasLink2")
|
||||
void regattas2Clicked(ClickEvent event) {
|
||||
showRegattas();
|
||||
showRegattas(event);
|
||||
}
|
||||
|
||||
@UiHandler("seriesLeaderboardAnchor")
|
||||
@@ -244,8 +254,10 @@ public class EventHeader extends AbstractEventComposite {
|
||||
// showRegattas();
|
||||
// }
|
||||
//
|
||||
private void showRegattas() {
|
||||
private void showRegattas(ClickEvent clickevent) {
|
||||
getPageNavigator().goToRegattas();
|
||||
clickevent.preventDefault();
|
||||
|
||||
// setActiveLink(links1, regattasLink);
|
||||
// setActiveLink(links2, regattasLink2);
|
||||
// setActiveLink(links3, regattasLink3);
|
||||
|
||||
+2
-2
@@ -62,10 +62,10 @@
|
||||
<div class="{local_res.css.eventnavigation} {local_res.css.eventnavigationcompact}">
|
||||
<div class="{res.mainCss.grid}">
|
||||
<div class="{res.mediaCss.columns}">
|
||||
<g:Anchor href="javascript:;" ui:field="regattasLink">
|
||||
<g:Anchor ui:field="regattasLink">
|
||||
<img ui:field='eventLogo2' alt="" height="41" width="41" class="{local_res.css.eventnavigationcompact_logo}"></img>
|
||||
</g:Anchor>
|
||||
<g:Anchor href="javascript:;" ui:field="regattasLink2" styleName="{res.mainCss.button} {local_res.css.eventnavigation_link}">
|
||||
<g:Anchor ui:field="regattasLink2" styleName="{res.mainCss.button} {local_res.css.eventnavigation_link}">
|
||||
<span ui:field='eventName2Span' />
|
||||
</g:Anchor>
|
||||
</div>
|
||||
|
||||
+15
-11
@@ -21,6 +21,7 @@ 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.shared.LongNamesUtil;
|
||||
@@ -39,7 +40,6 @@ public class Regatta extends Composite {
|
||||
|
||||
private final EventDTO event;
|
||||
private final Timer timerForClientServerOffset;
|
||||
private final EventPlaceNavigator pageNavigator;
|
||||
private StrippedLeaderboardDTO leaderboard;
|
||||
private RaceGroupDTO raceGroup;
|
||||
private final List<RegattaPhase> phasesElements;
|
||||
@@ -75,14 +75,16 @@ public class Regatta extends Composite {
|
||||
@UiField Image boatClassImage;
|
||||
|
||||
private PlaceNavigation<LeaderboardPlace> leaderboardNavigation;
|
||||
private final HomePlacesNavigator placeNavigator;
|
||||
private PlaceNavigation<EventPlace> regattaNavigation;
|
||||
private final HomePlacesNavigator placesNavigator;
|
||||
private final EventPlaceNavigator eventPlaceNavigator;
|
||||
|
||||
public Regatta(EventDTO event, Timer timerForClientServerOffset, boolean isSingleView, HomePlacesNavigator placeNavigator, EventPlaceNavigator pageNavigator) {
|
||||
public Regatta(EventDTO event, Timer timerForClientServerOffset, boolean isSingleView, HomePlacesNavigator placesNavigator, EventPlaceNavigator eventPlaceNavigator) {
|
||||
this.event = event;
|
||||
this.timerForClientServerOffset = timerForClientServerOffset;
|
||||
this.isSingleView = isSingleView;
|
||||
this.placeNavigator = placeNavigator;
|
||||
this.pageNavigator = pageNavigator;
|
||||
this.placesNavigator = placesNavigator;
|
||||
this.eventPlaceNavigator = eventPlaceNavigator;
|
||||
|
||||
phasesElements = new ArrayList<RegattaPhase>();
|
||||
|
||||
@@ -104,10 +106,12 @@ public class Regatta extends Composite {
|
||||
|
||||
if(isSingleView) {
|
||||
regattaDetailsLink.setVisible(false);
|
||||
leaderboardNavigation = placeNavigator.getLeaderboardNavigation(event.id.toString(), leaderboard.name, event.getBaseURL(), event.isOnRemoteServer());
|
||||
leaderboardNavigation = placesNavigator.getLeaderboardNavigation(event.id.toString(), leaderboard.name, event.getBaseURL(), event.isOnRemoteServer());
|
||||
leaderboardLink.setHref(leaderboardNavigation.getTargetUrl());
|
||||
} else {
|
||||
leaderboardLink.setVisible(false);
|
||||
regattaNavigation = placesNavigator.getRegattaNavigation(event.id.toString(), leaderboard.name, event.getBaseURL(), event.isOnRemoteServer());
|
||||
regattaDetailsLink.setHref(regattaNavigation.getTargetUrl());
|
||||
}
|
||||
|
||||
boolean hasLiveRace = leaderboard.hasLiveRace(timerForClientServerOffset.getLiveTimePointInMillis());
|
||||
@@ -150,7 +154,7 @@ public class Regatta extends Composite {
|
||||
} else {
|
||||
for(RaceGroupSeriesDTO series: raceGroup.getSeries()) {
|
||||
RegattaPhase regattaPhase = new RegattaPhase(series, leaderboardGroup,
|
||||
leaderboard, raceGroup, pageNavigator, timerForClientServerOffset);
|
||||
leaderboard, raceGroup, eventPlaceNavigator, timerForClientServerOffset);
|
||||
regattaPhasesPanel.appendChild(regattaPhase.getElement());
|
||||
phasesElements.add(regattaPhase);
|
||||
}
|
||||
@@ -162,12 +166,12 @@ public class Regatta extends Composite {
|
||||
}
|
||||
|
||||
@UiHandler("regattaDetailsLink")
|
||||
public void regattaDetailsLinkClicked(ClickEvent e) {
|
||||
pageNavigator.goToRegattaRaces(leaderboardGroup, leaderboard, raceGroup);
|
||||
void regattaDetailsLinkClicked(ClickEvent e) {
|
||||
eventPlaceNavigator.goToRegattaRaces(leaderboardGroup, leaderboard, raceGroup);
|
||||
}
|
||||
|
||||
@UiHandler("leaderboardLink")
|
||||
public void leaderboardLinkClicked(ClickEvent e) {
|
||||
placeNavigator.goToPlace(leaderboardNavigation);
|
||||
void leaderboardLinkClicked(ClickEvent e) {
|
||||
placesNavigator.goToPlace(leaderboardNavigation);
|
||||
}
|
||||
}
|
||||
+4
-3
@@ -16,6 +16,7 @@ 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.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.gwt.common.client.SharedResources;
|
||||
import com.sap.sailing.gwt.home.client.app.HomePlacesNavigator;
|
||||
@@ -41,7 +42,7 @@ public class EventRegattaList extends AbstractEventComposite {
|
||||
|
||||
@UiField DivElement regattaGroupsNavigationPanel;
|
||||
@UiField DivElement regattaListNavigationDiv;
|
||||
@UiField DivElement regattaListItemsDiv;
|
||||
@UiField HTMLPanel regattaListItemsPanel;
|
||||
@UiField AnchorElement filterNoLeaderboardGroupsAnchor;
|
||||
@UiField SpanElement allBoatClassesSelected;
|
||||
|
||||
@@ -89,7 +90,7 @@ public class EventRegattaList extends AbstractEventComposite {
|
||||
if (r != null) {
|
||||
Regatta regatta = new Regatta(event, timerForClientServerOffset, false, placeNavigator, pageNavigator);
|
||||
regatta.setData(r.getC(), hasMultipleLeaderboardGroups, r.getB(), r.getA());
|
||||
regattaListItemsDiv.appendChild(regatta.getElement());
|
||||
regattaListItemsPanel.add(regatta);
|
||||
List<Regatta> regattaElements = regattaElementsByLeaderboardGroup.get(leaderboardGroup.getName());
|
||||
if (regattaElements == null) {
|
||||
regattaElements = new ArrayList<Regatta>();
|
||||
@@ -99,7 +100,7 @@ public class EventRegattaList extends AbstractEventComposite {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void registerFilterLeaderboardGroupEvent(final AnchorElement filterLeaderboardGroupAnchor, final LeaderboardGroupDTO leaderboardGroup) {
|
||||
Event.sinkEvents(filterLeaderboardGroupAnchor, Event.ONCLICK);
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div ui:field="regattaListItemsDiv" />
|
||||
<g:HTMLPanel ui:field="regattaListItemsPanel" />
|
||||
</div>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
||||
Reference in new issue
Block a user