Merge branch 'master' of ssh://127.0.0.1/home/trac/git

This commit is contained in:
Generic Wiki User
2016-09-27 14:30:04 +00:00
12 changed files with 366 additions and 336 deletions
@@ -28,6 +28,7 @@ import com.sap.sailing.gwt.autoplay.client.place.player.AutoPlayerConfiguration;
import com.sap.sailing.gwt.autoplay.client.shared.leaderboard.LeaderboardWithHeaderPerspectiveLifecycle;
import com.sap.sailing.gwt.autoplay.client.shared.leaderboard.LeaderboardWithHeaderPerspectiveSettings;
import com.sap.sailing.gwt.common.authentication.FixedSailingAuthentication;
import com.sap.sailing.gwt.common.authentication.SAPSailingHeaderWithAuthentication;
import com.sap.sailing.gwt.common.client.SharedResources;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.raceboard.RaceBoardPerspectiveLifecycle;
@@ -44,7 +45,6 @@ import com.sap.sse.gwt.client.shared.perspective.PerspectiveCompositeLifecycleTa
import com.sap.sse.gwt.client.shared.perspective.PerspectiveCompositeSettings;
import com.sap.sse.gwt.client.shared.perspective.PerspectiveLifecycle;
import com.sap.sse.gwt.client.shared.perspective.PerspectiveLifecycleWithAllSettings;
import com.sap.sse.security.ui.authentication.generic.sapheader.SAPHeaderWithAuthentication;
import com.sap.sse.security.ui.client.UserService;
public class DesktopStartView extends Composite implements StartView {
@@ -53,7 +53,7 @@ public class DesktopStartView extends Composite implements StartView {
interface StartPageViewUiBinder extends UiBinder<Widget, DesktopStartView> {
}
@UiField(provided=true) SAPHeaderWithAuthentication sapHeader;
@UiField(provided=true) SAPSailingHeaderWithAuthentication sapHeader;
@UiField(provided=true) ListBox localeSelectionBox;
@UiField(provided=true) ListBox eventSelectionBox;
@UiField(provided=true) ListBox leaderboardSelectionBox;
@@ -82,8 +82,7 @@ public class DesktopStartView extends Composite implements StartView {
this.eventBus = eventBus;
this.events = new ArrayList<EventDTO>();
sapHeader = new SAPHeaderWithAuthentication(StringMessages.INSTANCE.sapSailingAnalytics(),
StringMessages.INSTANCE.autoplayConfiguration());
sapHeader = new SAPSailingHeaderWithAuthentication(StringMessages.INSTANCE.autoplayConfiguration());
new FixedSailingAuthentication(userService, sapHeader.getAuthenticationMenuView());
eventSelectionBox = new ListBox();
@@ -4,23 +4,23 @@ import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.RepeatingCommand;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.gwt.common.authentication.FixedSailingAuthentication;
import com.sap.sailing.gwt.common.authentication.SAPSailingHeaderWithAuthentication;
import com.sap.sailing.gwt.common.client.FullscreenUtil;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sse.gwt.client.shared.components.AbstractCompositeComponent;
import com.sap.sse.security.ui.authentication.generic.sapheader.SAPHeaderWithAuthentication;
import com.sap.sse.security.ui.client.UserService;
public class SAPHeaderComponent extends AbstractCompositeComponent<SAPHeaderComponentSettings> {
private SAPHeaderComponentSettings settings;
private final SAPHeaderComponentLifecycle componentLifecycle;
private final SAPHeaderWithAuthentication sapHeader;
private final SAPSailingHeaderWithAuthentication sapHeader;
public SAPHeaderComponent(SAPHeaderComponentLifecycle componentLifecycle, UserService userService, SAPHeaderComponentSettings settings,
StringMessages stringMessages, boolean startInAutoScreenMode) {
this.componentLifecycle = componentLifecycle;
this.settings = settings;
this.sapHeader = new SAPHeaderWithAuthentication(stringMessages.sapSailingAnalytics(), settings.getTitle());
this.sapHeader = new SAPSailingHeaderWithAuthentication(settings.getTitle());
new FixedSailingAuthentication(userService, sapHeader.getAuthenticationMenuView());
initWidget(sapHeader);
@@ -0,0 +1,20 @@
package com.sap.sailing.gwt.common.authentication;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sse.security.ui.authentication.generic.sapheader.SAPHeaderWithAuthentication;
public class SAPSailingHeaderWithAuthentication extends SAPHeaderWithAuthentication {
private static final String SAP_SAILING_URL = "http://www.sapsailing.com";
private static final String SAP_SAILING_APP_NAME = StringMessages.INSTANCE.sapSailingAnalytics();
public SAPSailingHeaderWithAuthentication() {
super(SAP_SAILING_APP_NAME, SAP_SAILING_URL);
}
public SAPSailingHeaderWithAuthentication(String headerText) {
super(SAP_SAILING_APP_NAME, SAP_SAILING_URL, headerText);
}
}
@@ -14,6 +14,7 @@ import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.sap.sailing.gwt.common.authentication.FixedSailingAuthentication;
import com.sap.sailing.gwt.common.authentication.SAPSailingHeaderWithAuthentication;
import com.sap.sailing.gwt.common.client.SharedResources;
import com.sap.sailing.gwt.regattaoverview.client.RegattaRaceStatesComponent.EntryHandler;
import com.sap.sailing.gwt.settings.client.regattaoverview.RegattaOverviewBaseSettings;
@@ -21,7 +22,6 @@ import com.sap.sailing.gwt.settings.client.regattaoverview.RegattaRaceStatesSett
import com.sap.sailing.gwt.ui.client.AbstractSailingEntryPoint;
import com.sap.sailing.gwt.ui.shared.RegattaOverviewEntryDTO;
import com.sap.sse.gwt.settings.SettingsToUrlSerializer;
import com.sap.sse.security.ui.authentication.generic.sapheader.SAPHeaderWithAuthentication;
public class RegattaOverviewEntryPoint extends AbstractSailingEntryPoint {
@@ -33,7 +33,7 @@ public class RegattaOverviewEntryPoint extends AbstractSailingEntryPoint {
private final Label clockLabel = new Label();
private final RegattaOverviewResources.LocalCss style = RegattaOverviewResources.INSTANCE.css();
private SAPHeaderWithAuthentication siteHeader;
private SAPSailingHeaderWithAuthentication siteHeader;
@Override
public void doOnModuleLoad() {
@@ -50,8 +50,7 @@ public class RegattaOverviewEntryPoint extends AbstractSailingEntryPoint {
clockLabel.addStyleName(style.clockLabel());
siteHeader = new SAPHeaderWithAuthentication(getStringMessages()
.sapSailingAnalytics());
siteHeader = new SAPSailingHeaderWithAuthentication();
new FixedSailingAuthentication(getUserService(), siteHeader.getAuthenticationMenuView());
siteHeader.addWidgetToRightSide(clockLabel);
@@ -16,6 +16,7 @@ import com.sap.sailing.domain.common.security.Permission;
import com.sap.sailing.domain.common.security.Roles;
import com.sap.sailing.domain.common.security.SailingPermissionsForRoleProvider;
import com.sap.sailing.gwt.common.authentication.FixedSailingAuthentication;
import com.sap.sailing.gwt.common.authentication.SAPSailingHeaderWithAuthentication;
import com.sap.sailing.gwt.ui.client.AbstractSailingEntryPoint;
import com.sap.sailing.gwt.ui.client.LeaderboardGroupsDisplayer;
import com.sap.sailing.gwt.ui.client.LeaderboardGroupsRefresher;
@@ -45,7 +46,6 @@ import com.sap.sse.security.ui.authentication.decorator.AuthorizedContentDecorat
import com.sap.sse.security.ui.authentication.decorator.WidgetFactory;
import com.sap.sse.security.ui.authentication.generic.GenericAuthentication;
import com.sap.sse.security.ui.authentication.generic.GenericAuthorizedContentDecorator;
import com.sap.sse.security.ui.authentication.generic.sapheader.SAPHeaderWithAuthentication;
import com.sap.sse.security.ui.client.component.UserManagementPanel;
import com.sap.sse.security.ui.client.i18n.StringMessages;
@@ -66,8 +66,7 @@ public class AdminConsoleEntryPoint extends AbstractSailingEntryPoint implements
private void createUI() {
HeaderPanel headerPanel = new HeaderPanel();
SAPHeaderWithAuthentication header = new SAPHeaderWithAuthentication(getStringMessages().sapSailingAnalytics(),
getStringMessages().administration());
SAPSailingHeaderWithAuthentication header = new SAPSailingHeaderWithAuthentication(getStringMessages().administration());
GenericAuthentication genericSailingAuthentication = new FixedSailingAuthentication(getUserService(), header.getAuthenticationMenuView());
AuthorizedContentDecorator authorizedContentDecorator = new GenericAuthorizedContentDecorator(genericSailingAuthentication);
authorizedContentDecorator.setContentWidgetFactory(new WidgetFactory() {
@@ -1,71 +1,71 @@
package com.sap.sailing.gwt.ui.leaderboardedit;
import java.util.List;
import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.domain.common.security.Permission;
import com.sap.sailing.domain.common.security.SailingPermissionsForRoleProvider;
import com.sap.sailing.gwt.common.authentication.FixedSailingAuthentication;
import com.sap.sailing.gwt.ui.client.AbstractSailingEntryPoint;
import com.sap.sse.gwt.client.async.AsyncActionsExecutor;
import com.sap.sse.gwt.client.async.MarkedAsyncCallback;
import com.sap.sse.security.ui.authentication.decorator.AuthorizedContentDecorator;
import com.sap.sse.security.ui.authentication.decorator.WidgetFactory;
import com.sap.sse.security.ui.authentication.generic.GenericAuthentication;
import com.sap.sse.security.ui.authentication.generic.GenericAuthorizedContentDecorator;
import com.sap.sse.security.ui.authentication.generic.sapheader.SAPHeaderWithAuthentication;
public class LeaderboardEditPage extends AbstractSailingEntryPoint {
@Override
protected void doOnModuleLoad() {
super.doOnModuleLoad();
sailingService.getLeaderboardNames(new MarkedAsyncCallback<List<String>>(
new AsyncCallback<List<String>>() {
@Override
public void onSuccess(List<String> leaderboardNames) {
final String leaderboardName = Window.Location.getParameter("name");
if (leaderboardNames.contains(leaderboardName)) {
SAPHeaderWithAuthentication header = initHeader();
GenericAuthentication genericSailingAuthentication = new FixedSailingAuthentication(getUserService(), header.getAuthenticationMenuView());
AuthorizedContentDecorator authorizedContentDecorator = new GenericAuthorizedContentDecorator(genericSailingAuthentication);
authorizedContentDecorator.setPermissionToCheck(Permission.MANAGE_LEADERBOARD_RESULTS, SailingPermissionsForRoleProvider.INSTANCE);
authorizedContentDecorator.setContentWidgetFactory(new WidgetFactory() {
@Override
public Widget get() {
EditableLeaderboardPanel leaderboardPanel = new EditableLeaderboardPanel(sailingService, new AsyncActionsExecutor(), leaderboardName, null,
LeaderboardEditPage.this, getStringMessages(), userAgent);
leaderboardPanel.ensureDebugId("EditableLeaderboardPanel");
return leaderboardPanel;
}
});
RootPanel.get().add(authorizedContentDecorator);
RootPanel.get().add(header);
} else {
RootPanel.get().add(new Label(getStringMessages().noSuchLeaderboard()));
}
}
@Override
public void onFailure(Throwable t) {
reportError("Error trying to obtain list of leaderboard names: "+t.getMessage());
}
}));
}
private SAPHeaderWithAuthentication initHeader() {
SAPHeaderWithAuthentication header = new SAPHeaderWithAuthentication(getStringMessages().sapSailingAnalytics(),
getStringMessages().editScores());
header.getElement().getStyle().setPosition(Position.FIXED);
header.getElement().getStyle().setTop(0, Unit.PX);
header.getElement().getStyle().setWidth(100, Unit.PCT);
return header;
}
}
package com.sap.sailing.gwt.ui.leaderboardedit;
import java.util.List;
import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.domain.common.security.Permission;
import com.sap.sailing.domain.common.security.SailingPermissionsForRoleProvider;
import com.sap.sailing.gwt.common.authentication.FixedSailingAuthentication;
import com.sap.sailing.gwt.common.authentication.SAPSailingHeaderWithAuthentication;
import com.sap.sailing.gwt.ui.client.AbstractSailingEntryPoint;
import com.sap.sse.gwt.client.async.AsyncActionsExecutor;
import com.sap.sse.gwt.client.async.MarkedAsyncCallback;
import com.sap.sse.security.ui.authentication.decorator.AuthorizedContentDecorator;
import com.sap.sse.security.ui.authentication.decorator.WidgetFactory;
import com.sap.sse.security.ui.authentication.generic.GenericAuthentication;
import com.sap.sse.security.ui.authentication.generic.GenericAuthorizedContentDecorator;
import com.sap.sse.security.ui.authentication.generic.sapheader.SAPHeaderWithAuthentication;
public class LeaderboardEditPage extends AbstractSailingEntryPoint {
@Override
protected void doOnModuleLoad() {
super.doOnModuleLoad();
sailingService.getLeaderboardNames(new MarkedAsyncCallback<List<String>>(
new AsyncCallback<List<String>>() {
@Override
public void onSuccess(List<String> leaderboardNames) {
final String leaderboardName = Window.Location.getParameter("name");
if (leaderboardNames.contains(leaderboardName)) {
SAPHeaderWithAuthentication header = initHeader();
GenericAuthentication genericSailingAuthentication = new FixedSailingAuthentication(getUserService(), header.getAuthenticationMenuView());
AuthorizedContentDecorator authorizedContentDecorator = new GenericAuthorizedContentDecorator(genericSailingAuthentication);
authorizedContentDecorator.setPermissionToCheck(Permission.MANAGE_LEADERBOARD_RESULTS, SailingPermissionsForRoleProvider.INSTANCE);
authorizedContentDecorator.setContentWidgetFactory(new WidgetFactory() {
@Override
public Widget get() {
EditableLeaderboardPanel leaderboardPanel = new EditableLeaderboardPanel(sailingService, new AsyncActionsExecutor(), leaderboardName, null,
LeaderboardEditPage.this, getStringMessages(), userAgent);
leaderboardPanel.ensureDebugId("EditableLeaderboardPanel");
return leaderboardPanel;
}
});
RootPanel.get().add(authorizedContentDecorator);
RootPanel.get().add(header);
} else {
RootPanel.get().add(new Label(getStringMessages().noSuchLeaderboard()));
}
}
@Override
public void onFailure(Throwable t) {
reportError("Error trying to obtain list of leaderboard names: "+t.getMessage());
}
}));
}
private SAPHeaderWithAuthentication initHeader() {
SAPSailingHeaderWithAuthentication header = new SAPSailingHeaderWithAuthentication(getStringMessages().editScores());
header.getElement().getStyle().setPosition(Position.FIXED);
header.getElement().getStyle().setTop(0, Unit.PX);
header.getElement().getStyle().setWidth(100, Unit.PCT);
return header;
}
}
@@ -10,6 +10,7 @@ import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.gwt.common.authentication.FixedSailingAuthentication;
import com.sap.sailing.gwt.common.authentication.SAPSailingHeaderWithAuthentication;
import com.sap.sailing.gwt.ui.client.AbstractSailingEntryPoint;
import com.sap.sailing.gwt.ui.client.RemoteServiceMappingConstants;
import com.sap.sailing.gwt.ui.client.SimulatorService;
@@ -21,7 +22,6 @@ import com.sap.sse.security.ui.authentication.decorator.AuthorizedContentDecorat
import com.sap.sse.security.ui.authentication.decorator.WidgetFactory;
import com.sap.sse.security.ui.authentication.generic.GenericAuthentication;
import com.sap.sse.security.ui.authentication.generic.GenericAuthorizedContentDecorator;
import com.sap.sse.security.ui.authentication.generic.sapheader.SAPHeaderWithAuthentication;
public class SimulatorEntryPoint extends AbstractSailingEntryPoint {
@@ -187,8 +187,7 @@ public class SimulatorEntryPoint extends AbstractSailingEntryPoint {
}
private void createSimulatorPanel() {
SAPHeaderWithAuthentication header = new SAPHeaderWithAuthentication(getStringMessages()
.sapSailingAnalytics(), getStringMessages().strategySimulatorTitle());
SAPSailingHeaderWithAuthentication header = new SAPSailingHeaderWithAuthentication(getStringMessages().strategySimulatorTitle());
GenericAuthentication genericSailingAuthentication = new FixedSailingAuthentication(getUserService(), header.getAuthenticationMenuView());
AuthorizedContentDecorator authorizedContentDecorator = new GenericAuthorizedContentDecorator(genericSailingAuthentication);
@@ -1,73 +1,81 @@
.siteheader {
font-size: 1rem;
line-height: 1.333;
background: #333;
border-bottom: 4px solid #f0ab00;
height: 75px;
width: 100%;
overflow: hidden;
vertical-align: top;
position: relative;
}
.siteHeaderTitle {
color: #fff;
vertical-align: top;
font-size: 20px;
font-weight: 700;
}
.siteHeaderSubTitle {
color: #fff;
font-size: 18px;
vertical-align: top;
}
.siteheaderLeft {
position: relative; top:10px;left:10px;
display: inline-block;
text-align: left;
height: 50px;
vertical-align: top;
}
.siteheader2ndCol {
position: absolute; top:10px;left:235px;
display: inline-block;
text-align: left;
height:50px;
vertical-align: top;
}
.siteheaderRight {
position: absolute; top:10px;right:10px;
text-align: right;
display: inline-block;
height:50px;
vertical-align: top;
}
.logo {
margin: 0px;
display: inline-block;
}
.logotitle {
font-size: 1rem;
display: inline-block;
color: #f6f9fc;
width: 150px;
height: 100%;
padding: 17px 15px 0 0;
vertical-align: top;
text-align: right;
border-right: 1px solid rgb(180,180,180);
margin: 0px;
margin-left: -25px;
box-sizing: border-box;
}
.pagetitle {
color: #ffffff;
font-size: 1.1rem;
font-weight: bold;
}
.siteheader {
font-size: 1rem;
line-height: 1.333;
background: #333;
border-bottom: 4px solid #f0ab00;
height: 75px;
width: 100%;
overflow: hidden;
vertical-align: top;
position: relative;
}
.siteHeaderTitle {
color: #fff;
vertical-align: top;
font-size: 20px;
font-weight: 700;
}
.siteHeaderSubTitle {
color: #fff;
font-size: 18px;
vertical-align: top;
}
.siteheaderLeft {
position: relative; top:10px;left:10px;
display: inline-block;
text-align: left;
height: 50px;
vertical-align: top;
}
.siteheader2ndCol {
position: absolute; top:10px;left:235px;
display: inline-block;
text-align: left;
height:50px;
vertical-align: top;
}
.siteheaderRight {
position: absolute; top:10px;right:10px;
text-align: right;
display: inline-block;
height:50px;
vertical-align: top;
}
.logo, .logo:hover, .logo:visited {
margin: 0px;
display: inline-block;
gwt-sprite: "logo";
background-size: cover;
width: 80px;
height: 40px;
border: none;
text-decoration: none;
}
.logotitle, .logotitle:hover, .logotitle:visited {
font-size: 1rem;
display: inline-block;
color: #fff;
width: 150px;
height: 100%;
padding: 17px 15px 0 0;
vertical-align: top;
text-align: right;
border: none;
border-right: 1px solid rgb(180,180,180);
margin: 0px;
margin-left: -25px;
box-sizing: border-box;
text-decoration: none;
}
.pagetitle {
color: #ffffff;
font-size: 1.1rem;
font-weight: bold;
}
@@ -1,65 +1,75 @@
package com.sap.sse.gwt.client.sapheader;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Style.Display;
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.Composite;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
/**
* Generic header widget that is designed with a SAP logo and SAP color scheme.
*
* The header has the following elements:
* <ul>
* <li>SAP Logo with an application title (like "Sailing Analytics")</li>
* <li>Page title</li>
* <li>Optional Subtitle</li>
* <li>Optional widget to show on the right side of the header</li>
* </ul>
*/
public class SAPHeader extends Composite {
private static SAPHeaderUiBinder uiBinder = GWT.create(SAPHeaderUiBinder.class);
interface SAPHeaderUiBinder extends UiBinder<Widget, SAPHeader> {
}
@UiField
DivElement applicationNameUi;
@UiField
DivElement pageTitleUi;
@UiField
DivElement titleUi;
@UiField
DivElement subTitleUi;
@UiField
SimplePanel rightSideUi;
public SAPHeader(String applicationName) {
SAPHeaderResources.INSTANCE.css().ensureInjected();
initWidget(uiBinder.createAndBindUi(this));
applicationNameUi.setInnerText(applicationName != null ? applicationName : "&nbsp;");
}
public void setHeaderTitle(String title) {
titleUi.setInnerText(title);
}
public void setHeaderSubTitle(String subtitle) {
if (subtitle == null || subtitle.isEmpty()) {
subTitleUi.getStyle().setDisplay(Display.NONE);
titleUi.getStyle().setMarginTop(14, Unit.PX);
} else {
subTitleUi.setInnerText(subtitle);
subTitleUi.getStyle().clearDisplay();
titleUi.getStyle().clearMarginTop();
}
}
public void addWidgetToRightSide(Widget widget) {
rightSideUi.add(widget);
}
}
package com.sap.sse.gwt.client.sapheader;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.AnchorElement;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.i18n.client.LocaleInfo;
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.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
/**
* Generic header widget that is designed with a SAP logo and SAP color scheme.
*
* The header has the following elements:
* <ul>
* <li>SAP Logo with an application title (like "Sailing Analytics")</li>
* <li>Page title</li>
* <li>Optional Subtitle</li>
* <li>Optional widget to show on the right side of the header</li>
* </ul>
*/
public class SAPHeader extends Composite {
private static final String LOGO_URL = "https://sapsponsorships.com/";
private static SAPHeaderUiBinder uiBinder = GWT.create(SAPHeaderUiBinder.class);
interface SAPHeaderUiBinder extends UiBinder<Widget, SAPHeader> {
}
@UiField
AnchorElement applicationNameAnchor;
@UiField
DivElement pageTitleUi;
@UiField
DivElement titleUi;
@UiField
DivElement subTitleUi;
@UiField
SimplePanel rightSideUi;
@UiField
AnchorElement logoAnchor;
public SAPHeader(String applicationName, String applicationBaseUrl) {
SAPHeaderResources.INSTANCE.css().ensureInjected();
initWidget(uiBinder.createAndBindUi(this));
applicationNameAnchor.setInnerText(applicationName != null ? applicationName : "&nbsp;");
logoAnchor.setHref(LOGO_URL);
String sapSailingUrl = applicationBaseUrl + "?locale=" + LocaleInfo.getCurrentLocale().getLocaleName();
applicationNameAnchor.setHref(sapSailingUrl);
}
public void setHeaderTitle(String title) {
titleUi.setInnerText(title);
}
public void setHeaderSubTitle(String subtitle) {
if (subtitle == null || subtitle.isEmpty()) {
subTitleUi.getStyle().setDisplay(Display.NONE);
titleUi.getStyle().setMarginTop(14, Unit.PX);
} else {
subTitleUi.setInnerText(subtitle);
subTitleUi.getStyle().clearDisplay();
titleUi.getStyle().clearMarginTop();
}
}
public void addWidgetToRightSide(Widget widget) {
rightSideUi.add(widget);
}
}
@@ -1,24 +1,20 @@
<!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">
<ui:with field="local_res"
type="com.sap.sse.gwt.client.sapheader.SAPHeaderResources" />
<g:HTMLPanel>
<header class="{local_res.css.siteheader}">
<div class="{local_res.css.siteheaderLeft}">
<g:Image resource="{local_res.logo}" pixelSize="80, 40" altText="SAP Sailing Analytics" styleName="{local_res.css.logo}"/>
<div ui:field="applicationNameUi" class="{local_res.css.logotitle}"></div>
</div>
<div
ui:field="pageTitleUi"
class="{local_res.css.siteheader2ndCol}"
>
<div ui:field="titleUi" style="margin-top:14px;" class="{local_res.css.siteHeaderTitle}"></div>
<div ui:field="subTitleUi" style="display:none;" class="{local_res.css.siteHeaderSubTitle}"></div>
</div>
<g:SimplePanel ui:field="rightSideUi" styleName="{local_res.css.siteheaderRight}">
</g:SimplePanel>
</header>
</g:HTMLPanel>
</ui:UiBinder>
<!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">
<ui:with field="local_res"
type="com.sap.sse.gwt.client.sapheader.SAPHeaderResources" />
<g:HTMLPanel>
<header class="{local_res.css.siteheader}">
<div class="{local_res.css.siteheaderLeft}">
<a class="{local_res.css.logo}" ui:field="logoAnchor" target="_blank"></a>
<a class="{local_res.css.logotitle}" target="_blank" ui:field="applicationNameAnchor"></a>
</div>
<div ui:field="pageTitleUi" class="{local_res.css.siteheader2ndCol}">
<div ui:field="titleUi" style="margin-top:14px;" class="{local_res.css.siteHeaderTitle}"></div>
<div ui:field="subTitleUi" style="display:none;" class="{local_res.css.siteHeaderSubTitle}"></div>
</div>
<g:SimplePanel ui:field="rightSideUi" styleName="{local_res.css.siteheaderRight}" />
</header>
</g:HTMLPanel>
</ui:UiBinder>
@@ -1,28 +1,28 @@
package com.sap.sse.gwt.client.sapheader;
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 SAPHeaderResources extends ClientBundle {
public static final SAPHeaderResources INSTANCE = GWT.create(SAPHeaderResources.class);
@Source("SAPHeader.gss")
LocalCss css();
public interface LocalCss extends CssResource {
String siteheader();
String siteheaderLeft();
String siteHeaderTitle();
String siteHeaderSubTitle();
String siteheader2ndCol();
String siteheaderRight();
String logo();
String logotitle();
String pagetitle();
}
@Source("logo-small@2x.png")
ImageResource logo();
}
package com.sap.sse.gwt.client.sapheader;
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 SAPHeaderResources extends ClientBundle {
public static final SAPHeaderResources INSTANCE = GWT.create(SAPHeaderResources.class);
@Source("SAPHeader.gss")
LocalCss css();
public interface LocalCss extends CssResource {
String siteheader();
String siteheaderLeft();
String siteHeaderTitle();
String siteHeaderSubTitle();
String siteheader2ndCol();
String siteheaderRight();
String logo();
String logotitle();
String pagetitle();
}
@Source("logo-small@2x.png")
ImageResource logo();
}
@@ -1,58 +1,58 @@
package com.sap.sse.security.ui.authentication.generic.sapheader;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sse.gwt.client.sapheader.SAPHeader;
import com.sap.sse.security.ui.authentication.generic.GenericAuthentication;
import com.sap.sse.security.ui.authentication.view.AuthenticationMenuView;
import com.sap.sse.security.ui.authentication.view.AuthenticationMenuViewImpl;
/**
* {@link SAPHeader} which is decorated by a authentication control on the right side. This is typically used to
* integrate with {@link GenericAuthentication}.
*/
public class SAPHeaderWithAuthentication extends SAPHeader {
private static final SAPHeaderWithAuthenticationResources res = SAPHeaderWithAuthenticationResources.INSTANCE;
private final SimplePanel rightWrapper;
private AuthenticationMenuView authenticationMenuView;
public SAPHeaderWithAuthentication(String applicationName, String headerTitle) {
this(applicationName);
setHeaderTitle(headerTitle);
}
public SAPHeaderWithAuthentication(String applicationName) {
super(applicationName);
res.css().ensureInjected();
FlowPanel rightWithAuthentication = new FlowPanel();
rightWithAuthentication.addStyleName(res.css().header_right_wrapper());
Anchor authenticationMenu = new Anchor();
authenticationMenu.addStyleName(res.css().usermanagement_icon());
rightWithAuthentication.add(authenticationMenu);
authenticationMenuView = new AuthenticationMenuViewImpl(authenticationMenu, res.css().usermanagement_loggedin(), res.css().usermanagement_open());
rightWrapper = new SimplePanel();
rightWrapper.addStyleName(res.css().header_right_extension());
rightWithAuthentication.add(rightWrapper);
super.addWidgetToRightSide(rightWithAuthentication);
}
@Override
public void addWidgetToRightSide(Widget widget) {
rightWrapper.add(widget);
}
/**
* @return the {@link AuthenticationMenuView} associated with the authentication control on the right side of the header.
*/
public AuthenticationMenuView getAuthenticationMenuView() {
return authenticationMenuView;
}
}
package com.sap.sse.security.ui.authentication.generic.sapheader;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sse.gwt.client.sapheader.SAPHeader;
import com.sap.sse.security.ui.authentication.generic.GenericAuthentication;
import com.sap.sse.security.ui.authentication.view.AuthenticationMenuView;
import com.sap.sse.security.ui.authentication.view.AuthenticationMenuViewImpl;
/**
* {@link SAPHeader} which is decorated by a authentication control on the right side. This is typically used to
* integrate with {@link GenericAuthentication}.
*/
public class SAPHeaderWithAuthentication extends SAPHeader {
private static final SAPHeaderWithAuthenticationResources res = SAPHeaderWithAuthenticationResources.INSTANCE;
private final SimplePanel rightWrapper;
private AuthenticationMenuView authenticationMenuView;
public SAPHeaderWithAuthentication(String applicationName, String applicationBaseUrl, String headerTitle) {
this(applicationName, applicationBaseUrl);
setHeaderTitle(headerTitle);
}
public SAPHeaderWithAuthentication(String applicationName, String applicationBaseUrl) {
super(applicationName, applicationBaseUrl);
res.css().ensureInjected();
FlowPanel rightWithAuthentication = new FlowPanel();
rightWithAuthentication.addStyleName(res.css().header_right_wrapper());
Anchor authenticationMenu = new Anchor();
authenticationMenu.addStyleName(res.css().usermanagement_icon());
rightWithAuthentication.add(authenticationMenu);
authenticationMenuView = new AuthenticationMenuViewImpl(authenticationMenu, res.css().usermanagement_loggedin(), res.css().usermanagement_open());
rightWrapper = new SimplePanel();
rightWrapper.addStyleName(res.css().header_right_extension());
rightWithAuthentication.add(rightWrapper);
super.addWidgetToRightSide(rightWithAuthentication);
}
@Override
public void addWidgetToRightSide(Widget widget) {
rightWrapper.add(widget);
}
/**
* @return the {@link AuthenticationMenuView} associated with the authentication control on the right side of the header.
*/
public AuthenticationMenuView getAuthenticationMenuView() {
return authenticationMenuView;
}
}