added tablet version and i18n support for the main menu

This commit is contained in:
fmittag committed 2014-04-14 15:08:13 +02:00
1 parent d9fe67e93a
commit 5720bcbee4
15 files changed
+224 -30

No files matched your search

@@ -0,0 +1,39 @@
package com.sap.sailing.gwt.home.client.app;
import javax.inject.Singleton;
import com.gwtplatform.mvp.client.gin.AbstractPresenterModule;
import com.sap.sailing.gwt.home.client.aboutuspage.AboutUsPagePresenter;
import com.sap.sailing.gwt.home.client.aboutuspage.AboutUsPageView;
import com.sap.sailing.gwt.home.client.contactpage.ContactPagePresenter;
import com.sap.sailing.gwt.home.client.contactpage.ContactPageView;
import com.sap.sailing.gwt.home.client.eventpage.EventPagePresenter;
import com.sap.sailing.gwt.home.client.eventpage.EventPageView;
import com.sap.sailing.gwt.home.client.eventspage.EventsPagePresenter;
import com.sap.sailing.gwt.home.client.eventspage.EventsPageView;
import com.sap.sailing.gwt.home.client.startpage.StartPageTabletView;
import com.sap.sailing.gwt.home.client.startpage.StartPagePresenter;
public class ApplicationTabletModule extends AbstractPresenterModule {
@Override
protected void configure() {
// Application Presenters
bind(ApplicationTabletPresenter.class).in(Singleton.class);
bind(ApplicationTabletView.class).in(Singleton.class);
bind(AbstractRootPagePresenter.MyProxy.class).asEagerSingleton();
bind(AbstractRootPagePresenter.MyView.class).to(ApplicationTabletView.class);
bind(AbstractRootPagePresenter.class).to(ApplicationTabletPresenter.class);
// Presenters
bindPresenter(StartPagePresenter.class, StartPagePresenter.MyView.class, StartPageTabletView.class,
StartPagePresenter.MyProxy.class);
bindPresenter(EventsPagePresenter.class, EventsPagePresenter.MyView.class, EventsPageView.class,
EventsPagePresenter.MyProxy.class);
bindPresenter(EventPagePresenter.class, EventPagePresenter.MyView.class, EventPageView.class,
EventPagePresenter.MyProxy.class);
bindPresenter(AboutUsPagePresenter.class, AboutUsPagePresenter.MyView.class, AboutUsPageView.class,
AboutUsPagePresenter.MyProxy.class);
bindPresenter(ContactPagePresenter.class, ContactPagePresenter.MyView.class, ContactPageView.class,
ContactPagePresenter.MyProxy.class);
}
}
@@ -0,0 +1,12 @@
package com.sap.sailing.gwt.home.client.app;
import com.google.inject.Inject;
import com.google.web.bindery.event.shared.EventBus;
public class ApplicationTabletPresenter extends AbstractRootPagePresenter {
@Inject
public ApplicationTabletPresenter(final EventBus eventBus, final MyView view, final MyProxy proxy) {
super(eventBus, view, proxy);
}
}
@@ -0,0 +1,72 @@
package com.sap.sailing.gwt.home.client.app;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.Visibility;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.Widget;
import com.gwtplatform.mvp.client.ViewImpl;
import com.sap.sailing.gwt.home.client.shared.FooterPanel;
import com.sap.sailing.gwt.home.client.shared.HeaderPanel;
/**
* This is the top-level view of the application. Every time another presenter wants to reveal itself,
* {@link ApplicationTabletView} will add its content of the target inside the {@code mainContantPanel}.
*/
public class ApplicationTabletView extends ViewImpl implements AbstractRootPagePresenter.MyView {
interface ApplicationTabletViewUiBinder extends UiBinder<Widget, ApplicationTabletView> {
}
private static ApplicationTabletViewUiBinder uiBinder = GWT.create(ApplicationTabletViewUiBinder.class);
public final Widget widget;
@UiField(provided=true)
HeaderPanel headerPanel;
@UiField(provided=true)
FooterPanel footerPanel;
@UiField
FlowPanel mainContentPanel;
@UiField
Element loadingMessage;
public ApplicationTabletView() {
headerPanel = new HeaderPanel();
footerPanel = new FooterPanel();
widget = uiBinder.createAndBindUi(this);
}
@Override
public Widget asWidget() {
return widget;
}
@Override
public void setInSlot(Object slot, IsWidget content) {
if (slot == AbstractRootPagePresenter.TYPE_SetMainContent) {
setMainContent(content);
} else {
super.setInSlot(slot, content);
}
}
private void setMainContent(IsWidget content) {
mainContentPanel.clear();
if (content != null) {
mainContentPanel.add(content);
}
}
@Override
public void showLoading(boolean visibile) {
loadingMessage.getStyle().setVisibility(visibile ? Visibility.VISIBLE : Visibility.HIDDEN);
}
}
@@ -0,0 +1,15 @@
<!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:s="urn:import:com.sap.sailing.gwt.home.client.shared">
<g:HTMLPanel>
<div ui:field="loadingMessage" style="position:absolute; top:0; left:0; background-color:yellow;">Loading...</div>
<s:HeaderPanel ui:field="headerPanel" />
<g:FlowPanel ui:field="mainContentPanel" />
<s:FooterPanel ui:field="footerPanel" />
</g:HTMLPanel>
</ui:UiBinder>
@@ -6,9 +6,5 @@ import com.gwtplatform.mvp.client.UiHandlers;
* {@link ApplicationDesktopView}'s {@link UiHandlers}. * {@link ApplicationDesktopView}'s {@link UiHandlers}.
*/ */
public interface ApplicationUiHandlers extends UiHandlers { public interface ApplicationUiHandlers extends UiHandlers {
void revealAllProductsList(); void revealEvents();
void revealFavoriteProductsList();
void revealSpecialsList();
} }
@@ -0,0 +1,11 @@
package com.sap.sailing.gwt.home.client.gin;
import com.gwtplatform.mvp.client.gin.AbstractPresenterModule;
import com.sap.sailing.gwt.home.client.app.ApplicationTabletModule;
public class TabletModule extends AbstractPresenterModule {
@Override
protected void configure() {
install(new ApplicationTabletModule());
}
}
@@ -3,9 +3,9 @@ package com.sap.sailing.gwt.home.client.i18n;
import com.google.gwt.i18n.client.Messages; import com.google.gwt.i18n.client.Messages;
public interface TextMessages extends Messages { public interface TextMessages extends Messages {
String IsafId(); String chooseALanguage();
String Password(); String home();
String ForgotIsafId(); String events();
String ForgotPassword(); String aboutUs();
String ChooseALanguage(); String contact();
} }
@@ -1,5 +1,5 @@
IsafId=ISAF-ID chooseALanguage=Choose a language
Password=Password events=Events
ForgotIsafId=Forgot ISAF-ID? home=Home
ForgotPassword=Forgot Password? aboutUs=About us
ChooseALanguage=Choose a language contact=Contact
@@ -1,5 +1,5 @@
IsafId=ISAF-ID chooseALanguage=Wähle eine Sprache
Password=Passwort events=Veranstaltungen
ForgotIsafId=ISAF-ID vergessen? home=Startseite
ForgotPassword=Passwort vergessen? aboutUs=Über uns
ChooseALanguage=Wähle eine Sprache contact=Kontakt
@@ -2,6 +2,7 @@
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:s="urn:import:com.sap.sailing.gwt.home.client.shared"> xmlns:s="urn:import:com.sap.sailing.gwt.home.client.shared">
<ui:with field='i18n' type='com.sap.sailing.gwt.home.client.i18n.TextMessages'/>
<ui:style> <ui:style>
.panel { .panel {
width: 100%; width: 100%;
@@ -1,9 +1,9 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"> xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:with field='i18nTexts' type='com.sap.sailing.gwt.home.client.i18n.TextMessages'/> <ui:with field='i18n' type='com.sap.sailing.gwt.home.client.i18n.TextMessages'/>
<g:HorizontalPanel> <g:HorizontalPanel>
<g:Label text="{i18nTexts.ChooseALanguage}:" /> <g:Label text="{i18n.chooseALanguage}:" />
<g:ListBox ui:field="localeSelection" /> <g:ListBox ui:field="localeSelection" />
</g:HorizontalPanel> </g:HorizontalPanel>
</ui:UiBinder> </ui:UiBinder>
@@ -1,14 +1,14 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"> xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:with field="i18n" type="com.sap.sailing.gwt.home.client.i18n.TextMessages"/>
<ui:with type="com.sap.sailing.gwt.home.client.shared.PageNameConstants" field="pageNames"></ui:with> <ui:with field="pageNames" type="com.sap.sailing.gwt.home.client.shared.PageNameConstants" />
<g:HTMLPanel> <g:HTMLPanel>
<g:InlineHyperlink targetHistoryToken="{pageNames.getStartPage}">Home</g:InlineHyperlink> | <g:InlineHyperlink targetHistoryToken="{pageNames.getStartPage}" text="{i18n.home}" /> |
<g:InlineHyperlink targetHistoryToken="{pageNames.getEventsPage}">Events</g:InlineHyperlink> | <g:InlineHyperlink targetHistoryToken="{pageNames.getEventsPage}" text="{i18n.events}" /> |
<g:InlineHyperlink targetHistoryToken="{pageNames.getAboutUsPage}">About Us</g:InlineHyperlink> | <g:InlineHyperlink targetHistoryToken="{pageNames.getAboutUsPage}" text="{i18n.aboutUs}" /> |
<g:InlineHyperlink targetHistoryToken="{pageNames.getContactPage}">Contact</g:InlineHyperlink> <g:InlineHyperlink targetHistoryToken="{pageNames.getContactPage}" text="{i18n.contact}" />
</g:HTMLPanel> </g:HTMLPanel>
</ui:UiBinder> </ui:UiBinder>
@@ -0,0 +1,33 @@
package com.sap.sailing.gwt.home.client.startpage;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.Widget;
public class StartPageTabletView extends Composite implements StartPagePresenter.MyView {
private static StartPageMobileViewUiBinder uiBinder = GWT.create(StartPageMobileViewUiBinder.class);
interface StartPageMobileViewUiBinder extends UiBinder<Widget, StartPageTabletView> {
}
public StartPageTabletView() {
super();
initWidget(uiBinder.createAndBindUi(this));
}
@Override
public void addToSlot(Object slot, IsWidget content) {
}
@Override
public void removeFromSlot(Object slot, IsWidget content) {
}
@Override
public void setInSlot(Object slot, IsWidget content) {
}
}
@@ -0,0 +1,17 @@
<!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:style>
.panel {
width: 100%;
background-color: rgb(255,255,255);
border: solid 1px black;
}
</ui:style>
<g:VerticalPanel styleName="{style.panel}">
<g:HTML>
Home content TABLET
</g:HTML>
</g:VerticalPanel>
</ui:UiBinder>
@@ -49,10 +49,8 @@
value="com.sap.sailing.gwt.home.client.gin.DesktopModule" /> value="com.sap.sailing.gwt.home.client.gin.DesktopModule" />
<set-configuration-property name="gin.ginjector.module.mobile" <set-configuration-property name="gin.ginjector.module.mobile"
value="com.sap.sailing.gwt.home.client.gin.MobileModule" /> value="com.sap.sailing.gwt.home.client.gin.MobileModule" />
<!--
<set-configuration-property name="gin.ginjector.module.tablet" <set-configuration-property name="gin.ginjector.module.tablet"
value="com.sap.sailing.gwt.home.client.gin.TabletModule" /> value="com.sap.sailing.gwt.home.client.gin.TabletModule" />
-->
<!-- Shared modules --> <!-- Shared modules -->
<set-configuration-property name="gin.ginjector.modules" <set-configuration-property name="gin.ginjector.modules"