mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-27 22:37:15 +00:00
Added partials for mobile regatta progress
This commit is contained in:
1 parent
837e8bcd4c
commit
edb2b055e2
8 files changed
+256
No files matched your search
+64
@@ -0,0 +1,64 @@
|
||||
.eventsteps {
|
||||
font-size: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.eventsteps .grid {
|
||||
margin: 0;
|
||||
}
|
||||
.eventsteps_phases {
|
||||
padding: 0 1rem 1rem 1rem;
|
||||
}
|
||||
.eventsteps_phases_phase {
|
||||
font-size: 1rem;
|
||||
width: 50%;
|
||||
display: inline-block;
|
||||
padding: 0 0.333333333333333em;
|
||||
vertical-align: top;
|
||||
}
|
||||
.eventsteps_phases_phaseinactive {
|
||||
color: #999;
|
||||
}
|
||||
.eventsteps_phases_phase:first-child {
|
||||
padding-left: 0;
|
||||
}
|
||||
.eventsteps_phases_phase:last-child {
|
||||
padding-right: 0;
|
||||
}
|
||||
.eventsteps_phases_phase_name {
|
||||
font-size: 0.866666666666667em;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
text-align: center;
|
||||
padding: 1.153846153846154em 0;
|
||||
}
|
||||
.eventsteps_phases_phase_progressbar {
|
||||
height: 1em;
|
||||
width: 100%;
|
||||
border: 1px solid #dedede;
|
||||
}
|
||||
.eventsteps_phases_phase_progressbar_fleet {
|
||||
font-size: inherit;
|
||||
border-bottom: 1px solid #dedede;
|
||||
}
|
||||
.eventsteps_phases_phase_progressbar_fleet:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
.eventsteps_phases_phase_progressbar_fleet_progress {
|
||||
height: 100%;
|
||||
}
|
||||
.eventsteps_phases_phase_progress {
|
||||
text-align: center;
|
||||
margin-top: 0.666666666666667em;
|
||||
}
|
||||
img.eventsteps_phases_phase_progress_icon {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
height: 1.133333333333333em;
|
||||
width: 1.133333333333333em;
|
||||
margin-right: 0.666666666666667em;
|
||||
}
|
||||
.eventsteps_phases_phase_progress_text {
|
||||
font-size: 0.866666666666667em;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.sap.sailing.gwt.home.mobile.partials.eventsteps;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.sap.sailing.gwt.home.mobile.partials.section.MobileSection;
|
||||
import com.sap.sailing.gwt.home.mobile.partials.sectionHeader.SectionHeaderContent;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.regatta.RegattaProgressDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.regatta.RegattaProgressSeriesDTO;
|
||||
|
||||
public class EventSteps extends Composite {
|
||||
|
||||
private static EventStepsUiBinder uiBinder = GWT.create(EventStepsUiBinder.class);
|
||||
|
||||
interface EventStepsUiBinder extends UiBinder<MobileSection, EventSteps> {
|
||||
}
|
||||
|
||||
@UiField SectionHeaderContent sectionHeaderUi;
|
||||
private final MobileSection regattaProgessUi;
|
||||
|
||||
public EventSteps(RegattaProgressDTO regattaProgress) {
|
||||
initWidget(regattaProgessUi = uiBinder.createAndBindUi(this));
|
||||
sectionHeaderUi.setTitle(StringMessages.INSTANCE.progress());
|
||||
for (RegattaProgressSeriesDTO seriesProgress : regattaProgress.getSeries()) {
|
||||
regattaProgessUi.addContent(new EventStepsPhase(seriesProgress));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:mp="urn:import:com.sap.sailing.gwt.home.mobile.partials" xmlns:s="urn:import:com.sap.sailing.gwt.home.client.shared">
|
||||
<ui:with field="i18n" type="com.sap.sailing.gwt.ui.client.StringMessages" />
|
||||
<ui:with field="res" type="com.sap.sailing.gwt.home.mobile.resources.SharedResources" />
|
||||
<ui:with field="local_res" type="com.sap.sailing.gwt.home.mobile.partials.eventsteps.EventStepsResources" />
|
||||
<mp:section.MobileSection addStyleNames="{local_res.css.eventsteps} {res.mediaCss.small12} {res.mediaCss.columns}">
|
||||
<mp:header>
|
||||
<mp:sectionHeader.SectionHeaderContent ui:field="sectionHeaderUi" />
|
||||
</mp:header>
|
||||
</mp:section.MobileSection>
|
||||
</ui:UiBinder>
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package com.sap.sailing.gwt.home.mobile.partials.eventsteps;
|
||||
|
||||
import static com.sap.sailing.domain.common.LeaderboardNameConstants.DEFAULT_SERIES_NAME;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
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.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.Widget;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.regatta.RegattaProgressFleetDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.dispatch.regatta.RegattaProgressSeriesDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.race.FleetMetadataDTO;
|
||||
|
||||
public class EventStepsPhase extends Composite {
|
||||
|
||||
private static final StringMessages I18N = StringMessages.INSTANCE;
|
||||
private static EventStepsPhaseUiBinder uiBinder = GWT.create(EventStepsPhaseUiBinder.class);
|
||||
|
||||
interface EventStepsPhaseUiBinder extends UiBinder<Widget, EventStepsPhase> {
|
||||
}
|
||||
|
||||
@UiField DivElement seriesContainerUi;
|
||||
@UiField DivElement nameUi;
|
||||
@UiField ImageElement checkUi;
|
||||
@UiField SpanElement progressUi;
|
||||
@UiField DivElement fleetsContainerUi;
|
||||
|
||||
public EventStepsPhase(RegattaProgressSeriesDTO seriesProgress) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
nameUi.setInnerText(DEFAULT_SERIES_NAME.equals(seriesProgress.getName()) ? I18N.races() : seriesProgress.getName());
|
||||
if (seriesProgress.isCompleted()) {
|
||||
progressUi.setInnerText(String.valueOf(seriesProgress.getTotalRaceCount()));
|
||||
} else {
|
||||
checkUi.getStyle().setDisplay(Display.NONE);
|
||||
int current = seriesProgress.getProgressRaceCount(), total = seriesProgress.getTotalRaceCount();
|
||||
progressUi.setInnerText(I18N.currentOfTotal(current, total));
|
||||
}
|
||||
if (seriesProgress.getProgressRaceCount() == 0) {
|
||||
seriesContainerUi.addClassName(EventStepsResources.INSTANCE.css().eventsteps_phases_phaseinactive());
|
||||
}
|
||||
addFleetProgresses(seriesProgress.getFleetState(), seriesProgress.getTotalRaceCount());
|
||||
}
|
||||
|
||||
private void addFleetProgresses(Map<FleetMetadataDTO, RegattaProgressFleetDTO> fleetStates, int totalRaceCount) {
|
||||
double height = fleetStates.isEmpty() ? 100.0 : 100.0 / fleetStates.size();
|
||||
for (Entry<FleetMetadataDTO, RegattaProgressFleetDTO> fleetState : fleetStates.entrySet()) {
|
||||
double finishedWidth = (fleetState.getValue().getFinishedRaceCount() * 100.0) / totalRaceCount;
|
||||
double liveWidth = (fleetState.getValue().getFinishedAndLiveRaceCount() * 100.0) / totalRaceCount;
|
||||
String fleetColor = fleetState.getKey().getFleetColor();
|
||||
EventStepsPhaseFleet fleet = new EventStepsPhaseFleet(finishedWidth, liveWidth, height, fleetColor);
|
||||
fleetsContainerUi.appendChild(fleet.getElement());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:mp="urn:import:com.sap.sailing.gwt.home.mobile.partials" xmlns:s="urn:import:com.sap.sailing.gwt.home.client.shared">
|
||||
<ui:with field="i18n" type="com.sap.sailing.gwt.ui.client.StringMessages" />
|
||||
<ui:with field="res" type="com.sap.sailing.gwt.home.mobile.resources.SharedResources" />
|
||||
<ui:with field="local_res" type="com.sap.sailing.gwt.home.mobile.partials.eventsteps.EventStepsResources" />
|
||||
<g:HTMLPanel>
|
||||
<!-- IF phase.count === 0 ADD CLASS event-steps_phases_phase_inactive -->
|
||||
<div class="{local_res.css.eventsteps_phases_phase}" ui:field="seriesContainerUi">
|
||||
<div class="{local_res.css.eventsteps_phases_phase_name}" ui:field="nameUi"></div>
|
||||
<div class="{local_res.css.eventsteps_phases_phase_progressbar}" ui:field="fleetsContainerUi"></div>
|
||||
<div class="{local_res.css.eventsteps_phases_phase_progress}">
|
||||
<img src="images/home/icon-green-check.svg" class="{local_res.css.eventsteps_phases_phase_progress_icon}" ui:field="checkUi"></img>
|
||||
<span class="{local_res.css.eventsteps_phases_phase_progress_text}" ui:field="progressUi"></span>
|
||||
</div>
|
||||
</div>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.sap.sailing.gwt.home.mobile.partials.eventsteps;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.DivElement;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.UIObject;
|
||||
|
||||
public class EventStepsPhaseFleet extends UIObject {
|
||||
|
||||
private static EventStepsPhaseFleetUiBinder uiBinder = GWT.create(EventStepsPhaseFleetUiBinder.class);
|
||||
|
||||
interface EventStepsPhaseFleetUiBinder extends UiBinder<Element, EventStepsPhaseFleet> {
|
||||
}
|
||||
|
||||
@UiField DivElement progressLiveUi;
|
||||
@UiField DivElement progressUi;
|
||||
|
||||
public EventStepsPhaseFleet(double finishedWidth, double liveWidth, double height, String color) {
|
||||
setElement(uiBinder.createAndBindUi(this));
|
||||
getElement().getStyle().setHeight(height, Unit.PCT);
|
||||
progressUi.getStyle().setWidth(finishedWidth, Unit.PCT);
|
||||
progressUi.getStyle().setBackgroundColor(color);
|
||||
progressLiveUi.getStyle().setWidth(liveWidth, Unit.PCT);
|
||||
progressLiveUi.getStyle().setBackgroundColor("#ff4040");
|
||||
}
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:mp="urn:import:com.sap.sailing.gwt.home.mobile.partials" xmlns:s="urn:import:com.sap.sailing.gwt.home.client.shared">
|
||||
<ui:with field="i18n" type="com.sap.sailing.gwt.ui.client.StringMessages" />
|
||||
<ui:with field="res" type="com.sap.sailing.gwt.home.mobile.resources.SharedResources" />
|
||||
<ui:with field="local_res" type="com.sap.sailing.gwt.home.mobile.partials.eventsteps.EventStepsResources" />
|
||||
<div class="{local_res.css.eventsteps_phases_phase_progressbar_fleet}">
|
||||
<div class="{local_res.css.eventsteps_phases_phase_progressbar_fleet_progress}" ui:field="progressLiveUi"></div>
|
||||
<div class="{local_res.css.eventsteps_phases_phase_progressbar_fleet_progress}" ui:field="progressUi"></div>
|
||||
</div>
|
||||
</ui:UiBinder>
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.sap.sailing.gwt.home.mobile.partials.eventsteps;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
import com.google.gwt.resources.client.CssResource;
|
||||
|
||||
public interface EventStepsResources extends ClientBundle {
|
||||
public static final EventStepsResources INSTANCE = GWT.create(EventStepsResources.class);
|
||||
|
||||
@Source("EventSteps.gss")
|
||||
LocalCss css();
|
||||
|
||||
public interface LocalCss extends CssResource {
|
||||
String eventsteps();
|
||||
String grid();
|
||||
String eventsteps_phases();
|
||||
String eventsteps_phases_phase();
|
||||
String eventsteps_phases_phaseinactive();
|
||||
String eventsteps_phases_phase_name();
|
||||
String eventsteps_phases_phase_progressbar();
|
||||
String eventsteps_phases_phase_progressbar_fleet();
|
||||
String eventsteps_phases_phase_progressbar_fleet_progress();
|
||||
String eventsteps_phases_phase_progress();
|
||||
String eventsteps_phases_phase_progress_icon();
|
||||
String eventsteps_phases_phase_progress_text();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user