deleted event logo class and moved dashboard header logic with logo and header in seperate class

This commit is contained in:
Alexander Ries committed 2016-02-11 13:39:23 +01:00
1 parent b3c79cce78
commit 2d32db5c71
9 files changed
+73 -158

No files matched your search

@@ -26,11 +26,3 @@
width: 100% !important;
height: 100% !important;
}
.eventLogo {
position: absolute;
right: 12.5px;
bottom: 10px;
height: 22.5pt;
z-index: 1;
}
@@ -1,18 +1,5 @@
@require 'theme';
.bar {
height: 100%;
margin-top: 20pt;
line-height: 15pt;
vertical-align: middle;
font-size: 15pt;
font-family: DASHBOARD_FONT_FAMILY;
width: 100%;
text-align: center;
font-weight: bold;
overflow: visible;
}
.page {
position: absolute;
border: none;
@@ -22,15 +9,12 @@
top: 0;
bottom: 30pt;
margin: 5pt;
margin-top: 0px;
}
.logo {
position: absolute;
width: 48pt;
height: 23.5pt;
margin-top: 17.5pt;
.header {
margin-top:20px;
margin-left: 10pt;
z-index: 1;
}
.collumn {
@@ -113,3 +97,12 @@
text-align: center;
top: 50%;
}
.event_logo {
position: absolute;
height: DASHBOARD_SPACE_MEDIUM;
width: auto;
right: 10pt;
bottom: 10pt;
z-index: 1;
}
@@ -2,13 +2,17 @@ package com.sap.sailing.dashboards.gwt.client.dashboardpanel;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Style.Visibility;
import com.google.gwt.safehtml.shared.UriUtils;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
@@ -20,7 +24,7 @@ import com.sap.sailing.dashboards.gwt.client.DashboardClientFactory;
import com.sap.sailing.dashboards.gwt.client.actions.GetIDFromRaceThatIsLiveAction;
import com.sap.sailing.dashboards.gwt.client.dataretriever.NumberOfWindBotsChangeListener;
import com.sap.sailing.dashboards.gwt.client.dataretriever.WindBotDataRetrieverProvider;
import com.sap.sailing.dashboards.gwt.client.eventlogo.EventLogo;
import com.sap.sailing.dashboards.gwt.client.header.DashboardHeader;
import com.sap.sailing.dashboards.gwt.client.notifications.orientation.WrongDeviceOrientationNotification;
import com.sap.sailing.dashboards.gwt.client.widgets.PollsLiveDataEvery5Seconds;
import com.sap.sailing.dashboards.gwt.client.widgets.startanalysis.StartAnalysisWidget;
@@ -31,6 +35,8 @@ import com.sap.sailing.dashboards.gwt.shared.DashboardURLParameters;
import com.sap.sailing.dashboards.gwt.shared.dto.RaceIdDTO;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.shared.EventDTO;
import com.sap.sse.gwt.client.media.ImageDTO;
/**
* This class contains all components of the Dashboard and the basic UI Elements of the Dashboard, like top and bottom
@@ -47,9 +53,9 @@ public class DashboardPanel extends Composite implements NumberOfWindBotsChangeL
@UiField
LayoutPanel root;
@UiField
HTMLPanel header;
DashboardHeader header;
@UiField
Carousel carousel;
@@ -69,6 +75,9 @@ public class DashboardPanel extends Composite implements NumberOfWindBotsChangeL
@UiField
public HTMLPanel windcharthint;
@UiField
public Image eventLogo;
@UiField(provided = true)
public StartAnalysisWidget startanalysisComponent;
@@ -89,26 +98,46 @@ public class DashboardPanel extends Composite implements NumberOfWindBotsChangeL
startlineAdvantageByGeometryWidget = new StartlineAdvantageByGeometryWidget(this.dashboardClientFactory);
stringConstants = StringMessages.INSTANCE;
initWidget(uiBinder.createAndBindUi(this));
initLogos();
windcharthint.getElement().setInnerText(stringConstants.dashboardWindChartHint());
loadAndAddEventLogo(dashboardClientFactory.getSailingService());
loadEventLogoAndName(dashboardClientFactory.getSailingService());
initAndAddWrongOrientationNotification();
registerForDashboardFiveSecondsTimer(dashboardClientFactory);
}
private void initLogos() {
Image logo = new Image();
logo.setResource(DashboardPanelResources.INSTANCE.logo_sap());
logo.getElement().addClassName(DashboardPanelResources.INSTANCE.style().logo());
Document.get().getBody().appendChild(logo.getElement());
}
private void loadAndAddEventLogo(SailingServiceAsync sailingServiceAsync){
private void loadEventLogoAndName(SailingServiceAsync sailingServiceAsync){
String eventId = DashboardURLParameters.EVENT_ID.getValue();
if (eventId != null) {
EventLogo eventLogo = EventLogo.getEventLogoFromEventId(sailingServiceAsync, eventId);
if (eventLogo != null) {
Document.get().getBody().appendChild(eventLogo.getElement());
try {
final UUID eventUUID = UUID.fromString(eventId);
logger.log(Level.INFO, "Loading EventDTO for id " + eventId);
sailingServiceAsync.getEventById(eventUUID, true, new AsyncCallback<EventDTO>() {
@Override
public void onSuccess(final EventDTO event) {
logger.log(Level.INFO, "Received EventDTO");
if (event != null) {
final ImageDTO logo = event.getLogoImage();
if (logo != null) {
eventLogo.getElement().setAttribute("src", UriUtils.fromString(logo.getSourceRef()).asString());
} else {
eventLogo.getElement().getStyle().setVisibility(Visibility.HIDDEN);
}
if (event.getName() != null) {
header.setEventText(event.getName());
Window.setTitle("Dashboard - "+event.getName());
}
} else {
logger.log(Level.INFO, "Received EventDTO is null");
}
}
@Override
public void onFailure(Throwable caught) {
logger.log(Level.INFO, "Failed to received EventDTO, "+caught.getMessage());
eventLogo.getElement().getStyle().setVisibility(Visibility.HIDDEN);
}
});
} catch (IllegalArgumentException e) {
eventLogo.getElement().getStyle().setVisibility(Visibility.HIDDEN);
}
}
}
@@ -117,24 +146,6 @@ public class DashboardPanel extends Composite implements NumberOfWindBotsChangeL
WrongDeviceOrientationNotification wrongDeviceOrientationNotification = new WrongDeviceOrientationNotification();
Document.get().getBody().appendChild(wrongDeviceOrientationNotification.getElement());
}
// private void addWindBotComponentsAsDataRetrieverListener(WindBotDataRetrieverProvider windBotDataRetrieverProvider) {
// for (WindBotWidget windBotComponent : windBotComponents) {
// logger.log(Level.INFO, "Registering WindBotDataRetrieverListener");
// windBotDataRetrieverProvider.addWindBotDataRetrieverListener(windBotComponent);
// }
// }
//
// private void removeWindBotComponentsAsDataRetrieverListener(
// WindBotDataRetrieverProvider windBotDataRetrieverProvider) {
// for (WindBotWidget windBotComponent : windBotComponents) {
// windBotDataRetrieverProvider.removeWindBotDataRetrieverListener(windBotComponent);
// }
// }
private void setHeaderText(String raceName) {
this.header.getElement().setInnerText(raceName);
}
@Override
public void timeChanged(Date newTime, Date oldTime) {
@@ -147,7 +158,7 @@ public class DashboardPanel extends Composite implements NumberOfWindBotsChangeL
public void onSuccess(RaceIdDTO result) {
if (result != null && result.getRaceId() != null) {
logger.log(Level.INFO, "Updating UI with live race id");
setHeaderText(result.getRaceId().getRaceName());
header.setRaceText(result.getRaceId().getRaceName());
} else {
logger.log(Level.INFO, "Received null for live race id");
}
@@ -186,24 +197,4 @@ public class DashboardPanel extends Composite implements NumberOfWindBotsChangeL
logger.log(Level.INFO, "Number of available windbots changed. WindBots List is null");
}
}
//
// private void initWindBotComponents(List<String> windBotIDs,
// WindBotDataRetrieverProvider windBotDataRetrieverProvider) {
// int windBotAddedCounterTOConsiderForPanels = 0;
// removeWindBotComponentsAsDataRetrieverListener(windBotDataRetrieverProvider);
// windBotComponents.clear();
// for (String windBotID : windBotIDs) {
// if (windBotAddedCounterTOConsiderForPanels == 0) {
// WindBotWidget leftwindBotComponent = new WindBotWidget(windBotID, dashboardClientFactory);
// leftwindbotcontainer.add(leftwindBotComponent);
// windBotComponents.add(leftwindBotComponent);
// } else if (windBotAddedCounterTOConsiderForPanels == 1) {
// WindBotWidget rightwindBotComponent = new WindBotWidget(windBotID, dashboardClientFactory);
// rightwindbotcontainer.add(rightwindBotComponent);
// windBotComponents.add(rightwindBotComponent);
// }
// windBotAddedCounterTOConsiderForPanels++;
// }
// addWindBotComponentsAsDataRetrieverListener(windBotDataRetrieverProvider);
// }
}
@@ -1,6 +1,7 @@
<!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:client="urn:import:com.sap.sailing.dashboards.gwt.client"
xmlns:header="urn:import:com.sap.sailing.dashboards.gwt.client.header"
xmlns:windbot="urn:import:com.sap.sailing.dashboards.gwt.client.widgets.windbot"
xmlns:startlineadvantagegeometry="urn:import:com.sap.sailing.dashboards.gwt.client.widgets.startlineadvantage.course"
xmlns:startlineadvantagewind="urn:import:com.sap.sailing.dashboards.gwt.client.widgets.startlineadvantage.wind"
@@ -11,10 +12,10 @@
<ui:with field="resources" type="com.sap.sailing.dashboards.gwt.client.dashboardpanel.DashboardPanelResources"/>
<g:LayoutPanel ui:field="root">
<g:layer left="0%" top="0%" right="0%" height="35pt">
<g:HTMLPanel ui:field="header" styleName="{resources.style.bar}"></g:HTMLPanel>
<g:layer left="0%" top="0%" right="0%" height="55px">
<header:DashboardHeader ui:field="header" styleName="{resources.style.header}"></header:DashboardHeader>
</g:layer>
<g:layer left="0pt" top="35pt" right="0pt" bottom="0pt">
<g:layer left="0pt" top="55px" right="0pt" bottom="0pt">
<mgwtcarousel:Carousel ui:field="carousel">
<mgwtpanel:Panel styleName="{resources.style.page}">
<g:HTMLPanel ui:field="leftwindbotcontainer" styleName="{resources.style.collumn} {resources.style.left}">
@@ -40,8 +41,10 @@
</mgwtpanel:Panel>
</mgwtcarousel:Carousel>
</g:layer>
<g:layer left="0%" bottom="0%" right="0%" height="30pt">
<g:HTMLPanel ui:field="bottombar" styleName="{resources.style.bar}"></g:HTMLPanel>
<g:layer left="0%" bottom="0%" right="0%" height="50px">
<g:HTMLPanel ui:field="bottombar">
<g:Image ui:field="eventLogo" styleName="{resources.style.event_logo}"></g:Image>
</g:HTMLPanel>
</g:layer>
</g:LayoutPanel>
@@ -7,25 +7,20 @@ package com.sap.sailing.dashboards.gwt.client.dashboardpanel;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.resources.client.ImageResource;
public interface DashboardPanelResources extends ClientBundle {
public static final DashboardPanelResources INSTANCE = GWT.create(DashboardPanelResources.class);
@Source("com/sap/sailing/dashboards/gwt/client/images/logo_sap.png")
ImageResource logo_sap();
@Source({"com/sap/sailing/dashboards/gwt/client/theme/theme.gss", "DashboardPanel.gss"})
DashboardGSS style();
public interface DashboardGSS extends CssResource {
String bar();
String page();
String header();
String collumn();
String startanalysiscollumn();
String collumnthree();
String logo();
String right();
String left();
String startline_advantage_by_wind_container();
@@ -33,5 +28,6 @@ public interface DashboardPanelResources extends ClientBundle {
String windcharthint();
String windloadinghint();
String windloadinghinttext();
String event_logo();
}
}
@@ -1,60 +0,0 @@
package com.sap.sailing.dashboards.gwt.client.eventlogo;
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.google.gwt.dom.client.Style.Visibility;
import com.google.gwt.safehtml.shared.UriUtils;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Image;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.shared.EventDTO;
import com.sap.sse.gwt.client.media.ImageDTO;
public class EventLogo extends Image {
private static final Logger logger = Logger.getLogger(EventLogo.class.getName());
protected EventLogo() {
super();
this.getElement().addClassName("eventLogo");
}
public static EventLogo getEventLogoFromEventId(SailingServiceAsync sailingServiceAsync, String eventId) {
final EventLogo eventLogo = new EventLogo();
try {
final UUID eventUUID = UUID.fromString(eventId);
logger.log(Level.INFO, "Loading EventDTO for id " + eventId);
sailingServiceAsync.getEventById(eventUUID, true, new AsyncCallback<EventDTO>() {
@Override
public void onSuccess(final EventDTO event) {
logger.log(Level.INFO, "Received EventDTO");
if (event != null) {
final ImageDTO logo = event.getLogoImage();
if (logo != null) {
eventLogo.getElement().setAttribute("src", UriUtils.fromString(logo.getSourceRef()).asString());
} else {
eventLogo.getElement().getStyle().setVisibility(Visibility.HIDDEN);
}
if (event.getName() != null) {
Window.setTitle(event.getName() + " Dashboard");
}
} else {
logger.log(Level.INFO, "Received EventDTO is null");
}
}
@Override
public void onFailure(Throwable caught) {
logger.log(Level.INFO, "Failed to received EventDTO, "+caught.getMessage());
eventLogo.getElement().getStyle().setVisibility(Visibility.HIDDEN);
}
});
} catch (IllegalArgumentException e) {
eventLogo.getElement().getStyle().setVisibility(Visibility.HIDDEN);
}
return eventLogo;
}
}
@@ -33,12 +33,11 @@
.race {
width: 100%;
height: DASHBOARD_FONT_SIZE_SMALL;
margin-top: DASHBOARD_SPACE_VERY_SMALL;
margin-top: 5px;
line-height: DASHBOARD_FONT_SIZE_SMALL;
vertical-align: middle;
font-size: DASHBOARD_FONT_SIZE_SMALL;
font-family: DASHBOARD_FONT_FAMILY;
text-align: center;
font-weight: bold;
overflow: visible;
}
@@ -5,7 +5,7 @@
height: DASHBOARD_SPACE_MEDIUM;
right: 0px;
top: 0px;
width: 200px;
width: 300px;
z-index: 3;
}
@@ -19,7 +19,7 @@
.settings_indication_label {
position: absolute;
width: 200px;
width: 300px;
height: DASHBOARD_SPACE_MEDIUM;
top: 0px;
right: DASHBOARD_SPACE_MEDIUM;
@@ -1,6 +1,7 @@
<!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:widget="urn:import:com.sap.sailing.dashboards.gwt.client.widgets">
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:widget="urn:import:com.sap.sailing.dashboards.gwt.client.widgets">
<ui:with field="resources"
type="com.sap.sailing.dashboards.gwt.client.popups.competitorselection.util.SettingsButtonWithSelectionIndicationLabelResources" />