Skip to content

Commit

Permalink
Merge pull request #86 from ArcBees/ol_update_slots
Browse files Browse the repository at this point in the history
Update ContentSlot to NestedSlot
  • Loading branch information
Olivier Lafleur committed Aug 24, 2015
2 parents ad66651 + bc33ae7 commit 01aa8ca
Show file tree
Hide file tree
Showing 39 changed files with 66 additions and 143 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ target
bin
META-INF
.checkstyle
.DS_Store
4 changes: 2 additions & 2 deletions carstore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

<groupId>com.gwtplatform</groupId>
<artifactId>carstore</artifactId>
<version>1.5-SNAPSHOT</version>
<version>1.5</version>
<packaging>war</packaging>
<name>GWTP Carstore</name>
<description>Simple application used for testing GWTP features.</description>

<properties>
<!-- Client -->
<gwt.version>2.7.0</gwt.version>
<gwtp.version>1.5-SNAPSHOT</gwtp.version>
<gwtp.version>1.5</gwtp.version>
<gin.version>2.1.2</gin.version>
<gwtquery.version>1.4.2</gwtquery.version>
<objectify-gwt.version>1.2.1</objectify-gwt.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.gwtplatform.carstore.client.application;

import com.google.gwt.event.shared.GwtEvent.Type;
import com.google.inject.Inject;
import com.google.web.bindery.event.shared.EventBus;
import com.gwtplatform.carstore.client.application.event.ActionBarVisibilityEvent;
Expand All @@ -25,10 +24,10 @@
import com.gwtplatform.carstore.client.application.widget.message.MessagesPresenter;
import com.gwtplatform.mvp.client.Presenter;
import com.gwtplatform.mvp.client.View;
import com.gwtplatform.mvp.client.annotations.ContentSlot;
import com.gwtplatform.mvp.client.annotations.ProxyStandard;
import com.gwtplatform.mvp.client.presenter.slots.NestedSlot;
import com.gwtplatform.mvp.client.presenter.slots.SingleSlot;
import com.gwtplatform.mvp.client.proxy.Proxy;
import com.gwtplatform.mvp.client.proxy.RevealContentHandler;

public class ApplicationPresenter extends Presenter<ApplicationPresenter.MyView, ApplicationPresenter.MyProxy>
implements ChangeActionBarEvent.ChangeActionBarHandler, ActionBarVisibilityEvent.ActionBarVisibilityHandler {
Expand All @@ -43,11 +42,10 @@ interface MyView extends View {
interface MyProxy extends Proxy<ApplicationPresenter> {
}

@ContentSlot
public static final Type<RevealContentHandler<?>> SLOT_MAIN_CONTENT = new Type<>();
public static final NestedSlot SLOT_MAIN_CONTENT = new NestedSlot();

public static final Object SLOT_MESSAGES_CONTENT = new Object();
public static final Object SLOT_HEADER_CONTENT = new Object();
public static final SingleSlot SLOT_MESSAGES_CONTENT = new SingleSlot();
public static final SingleSlot SLOT_HEADER_CONTENT = new SingleSlot();

private final HeaderPresenter headerPresenter;
private final MessagesPresenter messagesPresenter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import com.gwtplatform.mvp.client.ViewImpl;
Expand All @@ -43,17 +42,10 @@ interface Binder extends UiBinder<Widget, ApplicationView> {
ApplicationView(
Binder uiBinder) {
initWidget(uiBinder.createAndBindUi(this));
}

@Override
public void setInSlot(Object slot, IsWidget content) {
if (slot == ApplicationPresenter.SLOT_MAIN_CONTENT) {
main.setWidget(content);
} else if (slot == ApplicationPresenter.SLOT_HEADER_CONTENT) {
header.setWidget(content);
} else if (slot == ApplicationPresenter.SLOT_MESSAGES_CONTENT) {
messages.setWidget(content);
}
bindSlot(ApplicationPresenter.SLOT_MAIN_CONTENT, main);
bindSlot(ApplicationPresenter.SLOT_HEADER_CONTENT, header);
bindSlot(ApplicationPresenter.SLOT_MESSAGES_CONTENT, messages);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public interface MyProxy extends ProxyPlace<CarPresenter> {
CarMessages messages,
@Assisted MyProxy proxy,
@Assisted CarDto carDto) {
super(eventBus, view, proxy, RootCarPresenter.SLOT_SetCarContent);
super(eventBus, view, proxy, RootCarPresenter.SLOT_CAR_CONTENT);

this.carsDelegate = carsDelegate;
this.manufacturersDelegate = manufacturersDelegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@

import javax.inject.Inject;

import com.google.gwt.event.shared.GwtEvent.Type;
import com.google.web.bindery.event.shared.EventBus;
import com.gwtplatform.carstore.client.application.ApplicationPresenter;
import com.gwtplatform.carstore.client.application.cars.car.navigation.NavigationTabPresenter;
import com.gwtplatform.mvp.client.Presenter;
import com.gwtplatform.mvp.client.View;
import com.gwtplatform.mvp.client.annotations.ContentSlot;
import com.gwtplatform.mvp.client.annotations.ProxyStandard;
import com.gwtplatform.mvp.client.presenter.slots.NestedSlot;
import com.gwtplatform.mvp.client.presenter.slots.SingleSlot;
import com.gwtplatform.mvp.client.proxy.Proxy;
import com.gwtplatform.mvp.client.proxy.RevealContentHandler;

public class RootCarPresenter extends Presenter<RootCarPresenter.MyView, RootCarPresenter.MyProxy> {
public interface MyView extends View {
Expand All @@ -37,10 +36,9 @@ public interface MyView extends View {
public interface MyProxy extends Proxy<RootCarPresenter> {
}

@ContentSlot
public static final Type<RevealContentHandler<?>> SLOT_SetCarContent = new Type<>();
public static final NestedSlot SLOT_CAR_CONTENT = new NestedSlot();

public static final Object SLOT_TAB_BAR = new Object();
public static final SingleSlot SLOT_TAB_BAR = new SingleSlot();

private final NavigationTabPresenter navigationTabPresenter;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.SimplePanel;
import com.gwtplatform.mvp.client.ViewImpl;

Expand All @@ -38,14 +37,8 @@ interface Binder extends UiBinder<HTMLPanel, RootCarView> {
RootCarView(
Binder uiBinder) {
initWidget(uiBinder.createAndBindUi(this));
}

@Override
public void setInSlot(Object slot, IsWidget content) {
if (slot == RootCarPresenter.SLOT_TAB_BAR) {
tabBarPanel.setWidget(content);
} else if (slot == RootCarPresenter.SLOT_SetCarContent) {
contentPanel.setWidget(content);
}
bindSlot(RootCarPresenter.SLOT_TAB_BAR, tabBarPanel);
bindSlot(RootCarPresenter.SLOT_CAR_CONTENT, contentPanel);
}
}
2 changes: 1 addition & 1 deletion gwtp-samples/gwtp-sample-basic-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-samples</artifactId>
<version>1.5-SNAPSHOT</version>
<version>1.5</version>
</parent>

<artifactId>gwtp-sample-basic-spring</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gwtp-samples/gwtp-sample-basic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-samples</artifactId>
<version>1.5-SNAPSHOT</version>
<version>1.5</version>
</parent>

<artifactId>gwtp-sample-basic</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gwtp-samples/gwtp-sample-crawler-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-samples</artifactId>
<version>1.5-SNAPSHOT</version>
<version>1.5</version>
</parent>

<artifactId>gwtp-sample-crawler-service</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion gwtp-samples/gwtp-sample-mobile/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-samples</artifactId>
<version>1.5-SNAPSHOT</version>
<version>1.5</version>
</parent>

<artifactId>gwtp-sample-mobile</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class ApplicationDesktopPresenter extends AbstractApplicationPresenter im
MyView view,
MyProxy proxy,
PlaceManager placeManager) {
super(eventBus, view, proxy, BreadcrumbsPresenter.SLOT_SetMainContent);
super(eventBus, view, proxy, BreadcrumbsPresenter.SLOT_MAIN_CONTENT);

this.placeManager = placeManager;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class ApplicationMobilePresenter extends AbstractApplicationPresenter imp
MyView view,
MyProxy proxy,
PlaceManager placeManager) {
super(eventBus, view, proxy, BreadcrumbsPresenter.SLOT_SetMainContent);
super(eventBus, view, proxy, BreadcrumbsPresenter.SLOT_MAIN_CONTENT);

this.placeManager = placeManager;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class ApplicationTabletPresenter extends AbstractApplicationPresenter imp
MyView view,
MyProxy proxy,
PlaceManager placeManager) {
super(eventBus, view, proxy, BreadcrumbsPresenter.SLOT_SetMainContent);
super(eventBus, view, proxy, BreadcrumbsPresenter.SLOT_MAIN_CONTENT);

this.placeManager = placeManager;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.InlineHyperlink;
import com.google.gwt.user.client.ui.InlineLabel;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import com.gwtplatform.mvp.client.ViewImpl;
Expand Down Expand Up @@ -52,6 +51,8 @@ interface Binder extends UiBinder<Widget, BreadcrumbsMobileView> {
this.placeManager = placeManager;

initWidget(binder.createAndBindUi(this));

bindSlot(BreadcrumbsPresenter.SLOT_MAIN_CONTENT, mainContentPanel);
}

@Override
Expand All @@ -74,13 +75,4 @@ public void setBreadcrumbs(int index, String title) {
hyperlink.setHTML(title);
}
}

@Override
public void setInSlot(Object slot, IsWidget content) {
if (slot == BreadcrumbsPresenter.SLOT_SetMainContent) {
mainContentPanel.setWidget(content);
} else {
super.setInSlot(slot, content);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@

import javax.inject.Inject;

import com.google.gwt.event.shared.GwtEvent.Type;
import com.google.web.bindery.event.shared.EventBus;
import com.gwtplatform.mvp.client.Presenter;
import com.gwtplatform.mvp.client.View;
import com.gwtplatform.mvp.client.annotations.ContentSlot;
import com.gwtplatform.mvp.client.annotations.ProxyStandard;
import com.gwtplatform.mvp.client.presenter.slots.NestedSlot;
import com.gwtplatform.mvp.client.proxy.PlaceManager;
import com.gwtplatform.mvp.client.proxy.Proxy;
import com.gwtplatform.mvp.client.proxy.RevealContentHandler;
import com.gwtplatform.mvp.client.proxy.SetPlaceTitleHandler;

/**
Expand All @@ -53,8 +51,7 @@ public interface MyView extends View {
/**
* Use this in leaf presenters, inside their {@link #revealInParent} method.
*/
@ContentSlot
public static final Type<RevealContentHandler<?>> SLOT_SetMainContent = new Type<>();
public static final NestedSlot SLOT_MAIN_CONTENT = new NestedSlot();

private final PlaceManager placeManager;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.InlineHyperlink;
import com.google.gwt.user.client.ui.InlineLabel;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import com.gwtplatform.mvp.client.ViewImpl;
Expand Down Expand Up @@ -51,6 +50,8 @@ public interface Binder extends UiBinder<Widget, BreadcrumbsTabletView> {
this.placeManager = placeManager;

initWidget(binder.createAndBindUi(this));

bindSlot(BreadcrumbsPresenter.SLOT_MAIN_CONTENT, mainContentPanel);
}

@Override
Expand All @@ -73,13 +74,4 @@ public void setBreadcrumbs(int index, String title) {
hyperlink.setHTML(title);
}
}

@Override
public void setInSlot(Object slot, IsWidget content) {
if (slot == BreadcrumbsPresenter.SLOT_SetMainContent) {
mainContentPanel.setWidget(content);
} else {
super.setInSlot(slot, content);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.InlineHyperlink;
import com.google.gwt.user.client.ui.InlineLabel;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import com.gwtplatform.mvp.client.ViewImpl;
Expand Down Expand Up @@ -51,6 +50,8 @@ interface Binder extends UiBinder<Widget, BreadcrumbsView> {
this.placeManager = placeManager;

initWidget(binder.createAndBindUi(this));

bindSlot(BreadcrumbsPresenter.SLOT_MAIN_CONTENT, mainContentPanel);
}

@Override
Expand All @@ -73,13 +74,4 @@ public void setBreadcrumbs(int index, String title) {
hyperlink.setHTML(title);
}
}

@Override
public void setInSlot(Object slot, IsWidget content) {
if (slot == BreadcrumbsPresenter.SLOT_SetMainContent) {
mainContentPanel.setWidget(content);
} else {
super.setInSlot(slot, content);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public interface MyView extends View {
MyProxy proxy,
PlaceManager placeManager,
DispatchAsync dispatcher) {
super(eventBus, view, proxy, BreadcrumbsPresenter.SLOT_SetMainContent);
super(eventBus, view, proxy, BreadcrumbsPresenter.SLOT_MAIN_CONTENT);

this.placeManager = placeManager;
this.dispatcher = dispatcher;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public interface MyView extends View {
MyProxy proxy,
PlaceManager placeManager,
DispatchAsync dispatcher) {
super(eventBus, view, proxy, BreadcrumbsPresenter.SLOT_SetMainContent);
super(eventBus, view, proxy, BreadcrumbsPresenter.SLOT_MAIN_CONTENT);

this.placeManager = placeManager;
this.dispatcher = dispatcher;
Expand Down
2 changes: 1 addition & 1 deletion gwtp-samples/gwtp-sample-nested/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-samples</artifactId>
<version>1.5-SNAPSHOT</version>
<version>1.5</version>
</parent>

<artifactId>gwtp-sample-nested</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@

import javax.inject.Inject;

import com.google.gwt.event.shared.GwtEvent.Type;
import com.google.web.bindery.event.shared.EventBus;
import com.gwtplatform.mvp.client.Presenter;
import com.gwtplatform.mvp.client.View;
import com.gwtplatform.mvp.client.annotations.ContentSlot;
import com.gwtplatform.mvp.client.annotations.ProxyEvent;
import com.gwtplatform.mvp.client.annotations.ProxyStandard;
import com.gwtplatform.mvp.client.presenter.slots.NestedSlot;
import com.gwtplatform.mvp.client.proxy.LockInteractionEvent;
import com.gwtplatform.mvp.client.proxy.Proxy;
import com.gwtplatform.mvp.client.proxy.RevealContentHandler;

/**
* This is the top-level presenter of the hierarchy. Other presenters reveal themselves within this presenter.
Expand All @@ -53,8 +51,7 @@ public interface MyView extends View {
/**
* Use this in leaf presenters, inside their {@link #revealInParent} method.
*/
@ContentSlot
public static final Type<RevealContentHandler<?>> SLOT_SetMainContent = new Type<>();
public static final NestedSlot SLOT_MAIN_CONTENT = new NestedSlot();

@Inject
ApplicationPresenter(
Expand Down
Loading

0 comments on commit 01aa8ca

Please sign in to comment.