mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-14 16:20:57 +00:00
Merge branch 'ribdashboard_editselectedteam' into ribdashboard
This commit is contained in:
commit
08cfb7d3df
9 files changed
+113
-27
No files matched your search
@@ -19,7 +19,6 @@
|
||||
.mgwt-Scrollbar-Bar {
|
||||
border-radius: 0pt;
|
||||
background-color: #FFDD00;
|
||||
|
||||
}
|
||||
|
||||
.highcharts-container {
|
||||
@@ -69,4 +68,24 @@
|
||||
/* custom */
|
||||
height: 0pt;
|
||||
line-height: 0pt;
|
||||
}
|
||||
|
||||
.competitorEditButton {
|
||||
position: absolute;
|
||||
height: 23.5pt;
|
||||
width: 23.5pt;
|
||||
right: 10pt;
|
||||
top: 17.5pt;
|
||||
}
|
||||
|
||||
.competitorLabel{
|
||||
position: absolute;
|
||||
width: 200pt;
|
||||
height: 23.5pt;
|
||||
margin-top: 17.5pt;
|
||||
right: 43.5pt;
|
||||
font-size: 12pt;
|
||||
font-color: black;
|
||||
text-align: right;
|
||||
line-height: 23.5pt;
|
||||
}
|
||||
+59
-8
@@ -6,9 +6,15 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Document;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.client.Cookies;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.FocusPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
import com.sap.sailing.dashboards.gwt.client.bottomnotification.BottomNotification;
|
||||
import com.sap.sailing.dashboards.gwt.client.device.Location;
|
||||
@@ -49,13 +55,16 @@ public class RibDashboardDataRetriever implements RacingNotYetStartedPopupListen
|
||||
|
||||
private static final String PARAM_LEADERBOARD_GROUP_NAME = "leaderboardName";
|
||||
private static final String KEY_SLECTED_TEAM_COOKIE = "selectedTeam";
|
||||
private static final int SLECTED_TEAM_COOKIE_EXPIRE_TIME_IN_MILLIS = 60*1000*60*5;
|
||||
private static final int SLECTED_TEAM_COOKIE_EXPIRE_TIME_IN_MILLIS = 60 * 1000 * 60 * 5;
|
||||
|
||||
private String selectedTeamName;
|
||||
|
||||
private CompetitorSelectionPopup competitorSelectionPopup;
|
||||
private RacingNotYetStartedPopup popupRacingNotYetStarted;
|
||||
private BottomNotification bottomNotification;
|
||||
private FocusPanel competitorEditButton;
|
||||
private Label competitorLabel;
|
||||
private boolean shouldReloadStartAnalysis;
|
||||
|
||||
public RibDashboardDataRetriever() {
|
||||
initNonFinalMemberVariablesWithNoArgumentConstructor();
|
||||
@@ -66,6 +75,7 @@ public class RibDashboardDataRetriever implements RacingNotYetStartedPopupListen
|
||||
numberOfChachedStartAnalysisDTOs = 0;
|
||||
competitorSelectionPopup = new CompetitorSelectionPopup();
|
||||
selectedTeamName = Cookies.getCookie(KEY_SLECTED_TEAM_COOKIE);
|
||||
initCompetitorLabelAndAddToRootPanel();
|
||||
initBottomNotification();
|
||||
}
|
||||
|
||||
@@ -107,18 +117,29 @@ public class RibDashboardDataRetriever implements RacingNotYetStartedPopupListen
|
||||
setSelection(singletonList);
|
||||
if (result.startAnalysisDTOList != null) {
|
||||
int numberOfReceivedStartAnalysisDTOs = result.startAnalysisDTOList.size();
|
||||
if (numberOfChachedStartAnalysisDTOs != numberOfReceivedStartAnalysisDTOs) {
|
||||
if (numberOfChachedStartAnalysisDTOs != numberOfReceivedStartAnalysisDTOs || shouldReloadStartAnalysis == true) {
|
||||
shouldReloadStartAnalysis = false;
|
||||
numberOfChachedStartAnalysisDTOs = numberOfReceivedStartAnalysisDTOs;
|
||||
notifyNewStartAnalysisListener(result.startAnalysisDTOList);
|
||||
notifyNewStartAnalysisListener(result.startAnalysisDTOList, selectedTeamName);
|
||||
}
|
||||
}
|
||||
if(competitorEditButton == null){
|
||||
initCompetitorChangeButtonAndAddToRootPanel();
|
||||
setCompetitorLabelText(selectedTeamName);
|
||||
}
|
||||
if (result.competitorNamesFromLastTrackedRace != null
|
||||
&& result.competitorNamesFromLastTrackedRace.size() > 0
|
||||
&& !competitorSelectionPopup.isShown()) {
|
||||
competitorSelectionPopup.setCompetitorList(result.competitorNamesFromLastTrackedRace);
|
||||
competitorSelectionPopup.addListener(RibDashboardDataRetriever.this);
|
||||
}
|
||||
notifyDataObservers(result);
|
||||
competitorSelectionPopup.hide();
|
||||
break;
|
||||
case NO_COMPETITOR_SELECTED:
|
||||
popupRacingNotYetStarted.hide(true);
|
||||
if (result.competitorNamesFromLastTrackedRace != null
|
||||
&& result.competitorNamesFromLastTrackedRace.size() > 0 && !competitorSelectionPopup.isShown()) {
|
||||
&& result.competitorNamesFromLastTrackedRace.size() > 0
|
||||
&& !competitorSelectionPopup.isShown()) {
|
||||
competitorSelectionPopup.setCompetitorList(result.competitorNamesFromLastTrackedRace);
|
||||
competitorSelectionPopup.addListener(RibDashboardDataRetriever.this);
|
||||
competitorSelectionPopup.show();
|
||||
@@ -182,14 +203,40 @@ public class RibDashboardDataRetriever implements RacingNotYetStartedPopupListen
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyNewStartAnalysisListener(List<StartAnalysisDTO> startAnalysisDTOs) {
|
||||
public void notifyNewStartAnalysisListener(List<StartAnalysisDTO> startAnalysisDTOs, String selectedCompetitor) {
|
||||
synchronized (MUTEX) {
|
||||
for (NewStartAnalysisListener newStartAnalysisListener : newStartAnalysisListeners) {
|
||||
newStartAnalysisListener.addNewStartAnalysisCard(startAnalysisDTOs);
|
||||
newStartAnalysisListener.addNewStartAnalysisCardForCompetitor(startAnalysisDTOs, selectedCompetitor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void initCompetitorChangeButtonAndAddToRootPanel() {
|
||||
if (competitorEditButton == null) {
|
||||
competitorEditButton = new FocusPanel();
|
||||
competitorEditButton.addStyleName("competitorEditButton");
|
||||
Image settingsImage = new Image();
|
||||
settingsImage.setResource(RibDashboardImageResources.INSTANCE.settings());
|
||||
competitorEditButton.add(settingsImage);
|
||||
competitorEditButton.addDomHandler(new ClickHandler() {
|
||||
public void onClick(ClickEvent event) {
|
||||
competitorSelectionPopup.show();
|
||||
}
|
||||
}, ClickEvent.getType());
|
||||
RootPanel.get().add(competitorEditButton);
|
||||
}
|
||||
}
|
||||
|
||||
private void initCompetitorLabelAndAddToRootPanel() {
|
||||
competitorLabel = new Label();
|
||||
competitorLabel.addStyleName("competitorLabel");
|
||||
Document.get().getBody().appendChild(competitorLabel.getElement());
|
||||
}
|
||||
|
||||
private void setCompetitorLabelText(String slectedCompetitor) {
|
||||
competitorLabel.setText(slectedCompetitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void popupButtonClicked() {
|
||||
}
|
||||
@@ -198,7 +245,11 @@ public class RibDashboardDataRetriever implements RacingNotYetStartedPopupListen
|
||||
public void didClickedOKWithCompetitorName(String competitorName) {
|
||||
System.out.println("Did clicked with competitor " + competitorName);
|
||||
this.selectedTeamName = competitorName;
|
||||
Cookies.setCookie(KEY_SLECTED_TEAM_COOKIE, competitorName, new Date(new Date().getTime()+SLECTED_TEAM_COOKIE_EXPIRE_TIME_IN_MILLIS));
|
||||
Cookies.setCookie(KEY_SLECTED_TEAM_COOKIE, competitorName, new Date(new Date().getTime()
|
||||
+ SLECTED_TEAM_COOKIE_EXPIRE_TIME_IN_MILLIS));
|
||||
initCompetitorChangeButtonAndAddToRootPanel();
|
||||
setCompetitorLabelText(competitorName);
|
||||
shouldReloadStartAnalysis = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
@@ -41,4 +41,7 @@ public interface RibDashboardImageResources extends ClientBundle {
|
||||
|
||||
@Source("images/watch.png")
|
||||
ImageResource watch();
|
||||
|
||||
@Source("images/settings.png")
|
||||
ImageResource settings();
|
||||
}
|
||||
+2
-2
@@ -18,11 +18,11 @@
|
||||
<mgwtcarousel:Carousel ui:field="carousel">
|
||||
<mgwtpanel:Panel styleName="{style.page}">
|
||||
<g:HTMLPanel ui:field="leftwindbotcontainer" styleName="{style.collumn} {style.left}">
|
||||
<div ui:field="windloadinghintleft" class="{style.windloadinghint}"><div class="{style.windloadinghinttext}">Loading Wind Bot Data...</div></div>
|
||||
<div class="{style.windloadinghint}"><div ui:field="windloadinghintleft" class="{style.windloadinghinttext}">Loading Wind Bot Data...</div></div>
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="rightwindbotcontainer"
|
||||
styleName="{style.collumn} {style.right}">
|
||||
<div ui:field="windloadinghintright" class="{style.windloadinghint}"><div class="{style.windloadinghinttext}">Loading Wind Bot Data...</div></div>
|
||||
<div class="{style.windloadinghint}"><div ui:field="windloadinghintright" class="{style.windloadinghinttext}">Loading Wind Bot Data...</div></div>
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel styleName="{style.windcharthint}">Tab on chart to change interval.</g:HTMLPanel>
|
||||
</mgwtpanel:Panel>
|
||||
|
||||
+3
@@ -71,6 +71,7 @@ public class CompetitorSelectionPopup extends Composite implements HasWidgets, C
|
||||
this.getElement().addClassName(style.popupshow());
|
||||
this.getElement().removeClassName(style.popuphide());
|
||||
RootLayoutPanel.get().addStyleName(style.blurred());
|
||||
RootLayoutPanel.get().removeStyleName(style.not_blurred());
|
||||
isVisible = true;
|
||||
}
|
||||
|
||||
@@ -78,6 +79,7 @@ public class CompetitorSelectionPopup extends Composite implements HasWidgets, C
|
||||
this.getElement().addClassName(style.popuphide());
|
||||
this.getElement().removeClassName(style.popupshow());
|
||||
RootLayoutPanel.get().addStyleName(style.not_blurred());
|
||||
RootLayoutPanel.get().removeStyleName(style.blurred());
|
||||
RootPanel.get().remove(this);
|
||||
isVisible = false;
|
||||
}
|
||||
@@ -96,6 +98,7 @@ public class CompetitorSelectionPopup extends Composite implements HasWidgets, C
|
||||
for (CompetitorSelectionPopupListener newStartAnalysisListener : competitorSelectionPopupListener) {
|
||||
newStartAnalysisListener.didClickedOKWithCompetitorName(competitorName);
|
||||
}
|
||||
hide();
|
||||
}
|
||||
|
||||
public boolean isShown(){
|
||||
|
||||
+14
-14
@@ -19,9 +19,11 @@ public class CompetitorTable extends AbsolutePanel {
|
||||
public CompetitorTable(CompetitorTableRowSelectionListener competitorTableRowSelectionListener) {
|
||||
this.competitorTableRowSelectionListener = competitorTableRowSelectionListener;
|
||||
}
|
||||
|
||||
public void setTableContent(List<String> competitorNames){
|
||||
initTable(competitorNames);
|
||||
|
||||
public void setTableContent(List<String> competitorNames) {
|
||||
if (table == null) {
|
||||
initTable(competitorNames);
|
||||
}
|
||||
}
|
||||
|
||||
private void initTable(List<String> competitorNames) {
|
||||
@@ -32,19 +34,17 @@ public class CompetitorTable extends AbsolutePanel {
|
||||
table.setSkipRowHoverStyleUpdate(true);
|
||||
table.setSkipRowHoverCheck(true);
|
||||
table.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
|
||||
final SingleSelectionModel<String> selectionModel
|
||||
= new SingleSelectionModel<String>();
|
||||
final SingleSelectionModel<String> selectionModel = new SingleSelectionModel<String>();
|
||||
table.setSelectionModel(selectionModel);
|
||||
selectionModel.addSelectionChangeHandler(
|
||||
new SelectionChangeEvent.Handler() {
|
||||
public void onSelectionChange(SelectionChangeEvent event) {
|
||||
String selected = selectionModel.getSelectedObject();
|
||||
if (selected != null) {
|
||||
competitorTableRowSelectionListener.didSelectedRowWithCompetitorName(selected);
|
||||
}
|
||||
}
|
||||
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
||||
public void onSelectionChange(SelectionChangeEvent event) {
|
||||
String selected = selectionModel.getSelectedObject();
|
||||
if (selected != null) {
|
||||
competitorTableRowSelectionListener.didSelectedRowWithCompetitorName(selected);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
TextColumn<String> competitorNameCollumn = new TextColumn<String>() {
|
||||
@Override
|
||||
public String getValue(String competitorName) {
|
||||
|
||||
+1
-1
@@ -14,5 +14,5 @@ import com.sap.sailing.dashboards.gwt.shared.dto.startanalysis.StartAnalysisDTO;
|
||||
*/
|
||||
public interface NewStartAnalysisListener {
|
||||
|
||||
public void addNewStartAnalysisCard(List<StartAnalysisDTO> startAnalysisDTOs);
|
||||
public void addNewStartAnalysisCardForCompetitor(List<StartAnalysisDTO> startAnalysisDTOs, String selectedCompetitor);
|
||||
}
|
||||
+11
-1
@@ -88,6 +88,7 @@ public class StartlineAnalysisComponent extends Composite implements HasWidgets,
|
||||
private List<StartAnalysisDTO> starts;
|
||||
private List<StartAnalysisPageChangeListener> pageChangeListener;
|
||||
private BottomNotification bottomNotification;
|
||||
private String selectedCompetitor;
|
||||
|
||||
/**
|
||||
* The class requires a {@link BottomNotification} to inform the user when a new {@link StartlineAnalysisCard} gets
|
||||
@@ -196,6 +197,11 @@ public class StartlineAnalysisComponent extends Composite implements HasWidgets,
|
||||
|
||||
}
|
||||
|
||||
private void removeAllStartAnalysisCards() {
|
||||
startanalysis_card_container.clear();
|
||||
numberOfStartAnalysisCards = 0;
|
||||
}
|
||||
|
||||
public void registerPageChangeListener(StartAnalysisPageChangeListener s) {
|
||||
pageChangeListener.add(s);
|
||||
}
|
||||
@@ -211,12 +217,16 @@ public class StartlineAnalysisComponent extends Composite implements HasWidgets,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addNewStartAnalysisCard(List<StartAnalysisDTO> startAnalysisDTOs) {
|
||||
public void addNewStartAnalysisCardForCompetitor(List<StartAnalysisDTO> startAnalysisDTOs, String selectedCompetitor) {
|
||||
this.bottomNotification.show("New Start Analysis available.", "#F0AB00", "#000000", true);
|
||||
if (!selectedCompetitor.equals(this.selectedCompetitor)) {
|
||||
removeAllStartAnalysisCards();
|
||||
}
|
||||
for (int i = numberOfStartAnalysisCards; i <= startAnalysisDTOs.size() - 1; i++) {
|
||||
addStartAnalysisCard(startAnalysisDTOs.get(i));
|
||||
starts.add(startAnalysisDTOs.get(i));
|
||||
}
|
||||
this.selectedCompetitor = selectedCompetitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 416 B |
Reference in new issue
Block a user