mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-24 13:03:55 +00:00
the leaderboard in the LeaderboardPlace calculates initially it's size based on the rendered clientWidth and uses the LastNStrategy for the displayed race columns in case the panel would need a scrollbar. This logic will only be executed once.
This commit is contained in:
1 parent
942747ce65
commit
f82fc67bb2
6 files changed
+24
-30
No files matched your search
-6
@@ -1,6 +0,0 @@
|
||||
.oldLeaderboardPanel {
|
||||
/* background-color:#f8f8f8; */
|
||||
padding: 0 10px 10px 10px;
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
-1
@@ -50,7 +50,6 @@ public class OldLeaderboard extends Composite {
|
||||
public OldLeaderboard() {
|
||||
this.leaderboardPanel = null;
|
||||
EventRegattaLeaderboardResources.INSTANCE.css().ensureInjected();
|
||||
OldLeaderboardResources.INSTANCE.css().ensureInjected();
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
settingsAnchor.setTitle(StringMessages.INSTANCE.settings());
|
||||
autoRefreshAnchor.setTitle(StringMessages.INSTANCE.refresh());
|
||||
|
||||
+2
-3
@@ -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" />
|
||||
<ui:with field="local_res" type="com.sap.sailing.gwt.home.client.place.event.regattaleaderboard.EventRegattaLeaderboardResources" />
|
||||
<ui:with field="local_res2" type="com.sap.sailing.gwt.home.client.place.event.oldleaderboard.OldLeaderboardResources" />
|
||||
<g:HTMLPanel styleName=" {local_res.css.marginFix}">
|
||||
<div class="{res.mediaCss.grid}" >
|
||||
<div class="{res.mediaCss.small7} {res.mediaCss.column} {local_res.css.regattaleaderboard_meta_scoring}">
|
||||
@@ -24,11 +23,11 @@
|
||||
</div>
|
||||
|
||||
<div class="{res.mediaCss.grid}" >
|
||||
<div class="{res.mediaCss.small12} {res.mediaCss.columns} {local_res.css.letItScroll}">
|
||||
<div class="{res.mediaCss.small12} {res.mediaCss.columns} {local_res.css.letItScroll}">
|
||||
<table class="{local_res.css.regattaleaderboard_table}">
|
||||
<tr>
|
||||
<td>
|
||||
<g:HTMLPanel ui:field="oldLeaderboardPanel" styleName="{local_res2.css.oldLeaderboardPanel}">
|
||||
<g:HTMLPanel ui:field="oldLeaderboardPanel">
|
||||
</g:HTMLPanel>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
package com.sap.sailing.gwt.home.client.place.event.oldleaderboard;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
import com.google.gwt.resources.client.CssResource;
|
||||
|
||||
public interface OldLeaderboardResources extends ClientBundle {
|
||||
public static final OldLeaderboardResources INSTANCE = GWT.create(OldLeaderboardResources.class);
|
||||
|
||||
@Source("com/sap/sailing/gwt/home/client/place/event/oldleaderboard/OldLeaderboard.css")
|
||||
LocalCss css();
|
||||
|
||||
public interface LocalCss extends CssResource {
|
||||
String oldLeaderboardPanel();
|
||||
}
|
||||
}
|
||||
+20
-2
@@ -11,6 +11,8 @@ import com.sap.sailing.gwt.ui.client.LeaderboardUpdateListener;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardPanel;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardSettings;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.LeaderboardUrlSettings;
|
||||
import com.sap.sse.gwt.client.mutationobserver.ElementSizeMutationObserver;
|
||||
import com.sap.sse.gwt.client.mutationobserver.ElementSizeMutationObserver.DomMutationCallback;
|
||||
import com.sap.sse.gwt.shared.GwtHttpRequestUtils;
|
||||
|
||||
/**
|
||||
@@ -18,7 +20,8 @@ import com.sap.sse.gwt.shared.GwtHttpRequestUtils;
|
||||
*/
|
||||
public abstract class SharedLeaderboardRegattaTabView<T extends AbstractEventRegattaPlace> extends Composite implements RegattaTabView<T>,
|
||||
LeaderboardUpdateListener {
|
||||
|
||||
private boolean initialLeaderboardSizeCalculated = false;
|
||||
|
||||
public SharedLeaderboardRegattaTabView() {
|
||||
}
|
||||
|
||||
@@ -28,7 +31,7 @@ public abstract class SharedLeaderboardRegattaTabView<T extends AbstractEventReg
|
||||
final LeaderboardSettings leaderboardSettings = EventParamUtils
|
||||
.createLeaderboardSettingsFromURLParameters(Window.Location.getParameterMap());
|
||||
final RegattaAndRaceIdentifier preselectedRace = EventParamUtils.getPreselectedRace(Window.Location.getParameterMap());
|
||||
LeaderboardPanel leaderboardPanel = regattaAnalyticsManager.createLeaderboardPanel( //
|
||||
final LeaderboardPanel leaderboardPanel = regattaAnalyticsManager.createLeaderboardPanel( //
|
||||
leaderboardSettings, //
|
||||
preselectedRace, //
|
||||
"leaderboardGroupName", // TODO: keep using magic string? ask frank!
|
||||
@@ -36,6 +39,21 @@ public abstract class SharedLeaderboardRegattaTabView<T extends AbstractEventReg
|
||||
true,
|
||||
autoExpandLastRaceColumn);
|
||||
leaderboardPanel.addLeaderboardUpdateListener(this);
|
||||
|
||||
if(ElementSizeMutationObserver.isSupported()) {
|
||||
ElementSizeMutationObserver observer = new ElementSizeMutationObserver(new DomMutationCallback() {
|
||||
@Override
|
||||
public void onSizeChanged(int newWidth, int newHeight) {
|
||||
if(newWidth > 0 && newHeight > 0 && newWidth > 1500 && initialLeaderboardSizeCalculated == false) {
|
||||
int numberOfLastRacesToShow = (1500 - 600) / 50;
|
||||
leaderboardPanel.setRaceColumnSelectionToLastNStrategy(numberOfLastRacesToShow);
|
||||
initialLeaderboardSizeCalculated = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
observer.observe(leaderboardPanel.getLeaderboardTable().getElement());
|
||||
}
|
||||
|
||||
return leaderboardPanel;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -537,7 +537,7 @@ public class LeaderboardPanel extends SimplePanel implements TimeListener, PlayS
|
||||
}));
|
||||
}
|
||||
|
||||
void setRaceColumnSelectionToLastNStrategy(final Integer numberOfLastRacesToShow) {
|
||||
public void setRaceColumnSelectionToLastNStrategy(final Integer numberOfLastRacesToShow) {
|
||||
raceColumnSelection = new LastNRacesColumnSelection(numberOfLastRacesToShow, getRaceTimesInfoProvider());
|
||||
if (timer.getPlayState() != Timer.PlayStates.Playing) {
|
||||
// wait for the first update and adjust leaderboard once the race times have been received
|
||||
@@ -3019,7 +3019,7 @@ public class LeaderboardPanel extends SimplePanel implements TimeListener, PlayS
|
||||
return new CarryColumn();
|
||||
}
|
||||
|
||||
protected SortedCellTable<LeaderboardRowDTO> getLeaderboardTable() {
|
||||
public SortedCellTable<LeaderboardRowDTO> getLeaderboardTable() {
|
||||
return leaderboardTable;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user