some improvements of the regatta header partial

This commit is contained in:
fmittag committed 2014-07-23 16:21:47 +02:00
1 parent e86128b6af
commit 83d75ce64f
6 files changed
+40 -19

No files matched your search

@@ -2,6 +2,7 @@ package com.sap.sailing.gwt.home.client.place.event.regatta;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.HeadingElement;
import com.google.gwt.dom.client.SpanElement;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.Visibility;
@@ -38,11 +39,13 @@ public class Regatta extends Composite {
@SuppressWarnings("unused")
private LeaderboardGroupDTO leaderboardGroup;
@UiField SpanElement regattaName1;
@UiField SpanElement regattaName2;
@UiField HeadingElement regattaName1;
@UiField HeadingElement regattaName2;
@UiField DivElement leaderboardGroupName;
@UiField SpanElement scheduledStart;
@UiField DivElement regattaPhasesPanel;
@UiField DivElement regattaPhasesInfoDiv;
@UiField SpanElement competitorsCount;
@UiField SpanElement racesCount;
@UiField SpanElement trackedRacesCount;
@@ -95,6 +98,7 @@ public class Regatta extends Composite {
boolean isFinished = !hasLiveRace;
if(!isFinished) {
isFinishedDiv.getStyle().setDisplay(Display.NONE);
isFinishedDiv2.getStyle().setDisplay(Display.NONE);
}
String regattaDisplayName = leaderboard.displayName != null ? leaderboard.displayName : leaderboard.name;
@@ -115,14 +119,17 @@ public class Regatta extends Composite {
racesCount.setInnerText("tbd");
trackedRacesCount.setInnerText("tbd");
// regattaPhasesPanel.add(xxx);
setRegattaProgress();
}
private void setRegattaProgress() {
for(RaceGroupSeriesDTO series: raceGroup.getSeries()) {
RegattaPhase regattaPhase = new RegattaPhase(series);
regattaPhasesPanel.appendChild(regattaPhase.getElement());
if(raceGroup.getSeries().size() == 0) {
regattaPhasesInfoDiv.getStyle().setDisplay(Display.NONE);
} else {
for(RaceGroupSeriesDTO series: raceGroup.getSeries()) {
RegattaPhase regattaPhase = new RegattaPhase(series);
regattaPhasesPanel.appendChild(regattaPhase.getElement());
}
}
}
@@ -22,10 +22,10 @@
<div class="{res.mainCss.grid}">
<div class="{res.mediaCss.small4} {res.mediaCss.columns}">
<g:Anchor ui:field="regattaNameWithLink">
<h3 class="{local_res.css.regatta_intro_header_name}"><span ui:field="regattaName1" /></h3>
<h3 ui:field="regattaName1" class="{local_res.css.regatta_intro_header_name} {local_res.css.regatta_intro_header_namelink}" />
</g:Anchor>
<g:HTMLPanel ui:field="regattaNameDiv">
<h3 class="{local_res.css.regatta_intro_header_name}"><span ui:field="regattaName2" /></h3>
<h3 ui:field="regattaName2" class="{local_res.css.regatta_intro_header_name}"></h3>
</g:HTMLPanel>
<div ui:field="isLiveDiv" data-labeltype="live" class="{res.mainCss.label}"><ui:text from='{i18n.live}'/></div>
<div ui:field="isFinishedDiv" data-labeltype="finished" class="{res.mainCss.label}"><ui:text from='{i18n.finished}'/></div>
@@ -42,7 +42,7 @@
</div>
</div>
</div>
<div class="{local_res.css.regatta_intro_phases}">
<div ui:field="regattaPhasesInfoDiv" class="{local_res.css.regatta_intro_phases}">
<div ui:field="regattaPhasesPanel" />
<div class="{local_res.css.regatta_intro_phases_leaderboardlink}">
<g:Anchor ui:field="leaderboardLink"><ui:text from='{i18n.leaderBoard}'/></g:Anchor>
@@ -6,6 +6,8 @@ import com.google.gwt.dom.client.SpanElement;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.UIObject;
import com.sap.sailing.domain.common.LeaderboardNameConstants;
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
import com.sap.sailing.gwt.ui.shared.RaceGroupSeriesDTO;
public class RegattaPhase extends UIObject {
@@ -20,12 +22,24 @@ public class RegattaPhase extends UIObject {
public RegattaPhase(RaceGroupSeriesDTO series) {
RegattaResources.INSTANCE.css().ensureInjected();
setElement(uiBinder.createAndBindUi(this));
if(LeaderboardNameConstants.DEFAULT_SERIES_NAME.equals(series.getName())) {
phaseName.setInnerText("Races");
} else {
phaseName.setInnerText(series.getName());
}
phaseName.setInnerText(series.getName());
for(int i = 0; i < 5; i++) {
RegattaPhaseRace race = new RegattaPhaseRace();
series.getRaceColumns();
for(RaceColumnDTO raceColumn: series.getRaceColumns()) {
RegattaPhaseRace race = new RegattaPhaseRace(raceColumn);
phaseRacesPanel.appendChild(race.getElement());
}
}
public RegattaPhase() {
RegattaResources.INSTANCE.css().ensureInjected();
setElement(uiBinder.createAndBindUi(this));
phaseName.setInnerText("No series defined yet.");
}
}
@@ -5,6 +5,7 @@ import com.google.gwt.dom.client.DivElement;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.UIObject;
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
public class RegattaPhaseRace extends UIObject {
private static RegattaPhaseRaceUiBinder uiBinder = GWT.create(RegattaPhaseRaceUiBinder.class);
@@ -14,10 +15,10 @@ public class RegattaPhaseRace extends UIObject {
@UiField DivElement raceStatus;
public RegattaPhaseRace() {
public RegattaPhaseRace(RaceColumnDTO raceColumn) {
RegattaResources.INSTANCE.css().ensureInjected();
setElement(uiBinder.createAndBindUi(this));
raceStatus.setAttribute("data-status", "raceStatus");
raceStatus.setAttribute("data-status", "finished");
}
}
@@ -10,7 +10,6 @@ import com.google.gwt.dom.client.Style.Display;
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.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.gwt.home.client.place.event.EventPageNavigator;
import com.sap.sailing.gwt.home.client.place.event.regatta.Regatta;
@@ -29,7 +28,7 @@ public class EventRegattaList extends Composite {
@UiField DivElement regattaGroupsNavigationPanel;
@UiField DivElement regattaListNavgiationDiv;
@UiField HTMLPanel regattaListItemPanel;
@UiField DivElement regattaListItemsDiv;
@UiField AnchorElement allRegattasLink;
public EventRegattaList(EventDTO event, List<RaceGroupDTO> raceGroups,
@@ -45,7 +44,7 @@ public class EventRegattaList extends Composite {
Pair<StrippedLeaderboardDTO, LeaderboardGroupDTO> leaderboardWithLeaderboardGroup = leaderboardsWithLeaderboardGroup.get(raceGroup.getName());
regatta.setData(raceGroup, leaderboardWithLeaderboardGroup != null ? leaderboardWithLeaderboardGroup.getA() : null,
leaderboardWithLeaderboardGroup != null ? leaderboardWithLeaderboardGroup.getB() : null);
regattaListItemPanel.add(regatta);
regattaListItemsDiv.appendChild(regatta.getElement());
}
}
}
@@ -16,7 +16,7 @@
</div>
</div>
</div>
<g:HTMLPanel ui:field="regattaListItemPanel" />
<div ui:field="regattaListItemsDiv" />
</div>
</g:HTMLPanel>
</ui:UiBinder>