Skip to content

Commit

Permalink
Merge pull request ArcBees#316 from ArcBees/cv_rest_dispatch_update
Browse files Browse the repository at this point in the history
Updated Dispatch Projects
  • Loading branch information
Chris-V committed Dec 2, 2013
2 parents 6a3b268 + f224139 commit 9e0d3ad
Show file tree
Hide file tree
Showing 365 changed files with 8,611 additions and 4,136 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ bin
META-INF
.checkstyle
chromedriver.log
.errai/
2 changes: 1 addition & 1 deletion gwtp-build-tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@

<artifactId>gwtp-build-tools</artifactId>
<name>GWTP Build Tools</name>
</project>
</project>
26 changes: 14 additions & 12 deletions gwtp-carstore/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand All @@ -25,6 +26,7 @@
<gae.port>8888</gae.port>
<gae.address>127.0.0.1</gae.address>

<slf4j-api.version>1.6.1</slf4j-api.version>
<resteasy.version>3.0.2.Final</resteasy.version>
<arcbees.version>1.1.1</arcbees.version>
</properties>
Expand Down Expand Up @@ -125,6 +127,17 @@
</plugins>
</build>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j-api.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<!-- GWTP -->
<dependency>
Expand All @@ -133,23 +146,12 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>gwtp-dispatch-client</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>gwtp-dispatch-rest</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>gwtp-dispatch-shared</artifactId>
<version>${project.version}</version>
</dependency>

<!-- GWT -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@
import com.gwtplatform.carstore.client.security.LoggedInGatekeeper;
import com.gwtplatform.carstore.client.util.AbstractAsyncCallback;
import com.gwtplatform.carstore.client.util.ErrorHandlerAsyncCallback;
import com.gwtplatform.carstore.shared.dispatch.GetResult;
import com.gwtplatform.carstore.shared.dispatch.GetResults;
import com.gwtplatform.carstore.shared.dto.CarDto;
import com.gwtplatform.carstore.shared.dto.NumberDto;
import com.gwtplatform.dispatch.shared.DispatchAsync;
import com.gwtplatform.dispatch.shared.NoResult;
import com.gwtplatform.dispatch.rest.shared.RestDispatch;
import com.gwtplatform.mvp.client.HasUiHandlers;
import com.gwtplatform.mvp.client.Presenter;
import com.gwtplatform.mvp.client.View;
Expand All @@ -65,7 +61,7 @@ public interface MyView extends View, HasUiHandlers<CarsUiHandlers> {

void setCarsCount(Integer result);

void displayCars(int offset, List<CarDto> carDtos);
void displayCars(int offset, List<CarDto> cars);

HasData<CarDto> getCarDisplay();
}
Expand All @@ -76,7 +72,7 @@ public interface MyView extends View, HasUiHandlers<CarsUiHandlers> {
public interface MyProxy extends ProxyPlace<CarsPresenter> {
}

private final DispatchAsync dispatcher;
private final RestDispatch dispatcher;
private final CarService carService;
private final PlaceManager placeManager;
private final CarProxyFactory carProxyFactory;
Expand All @@ -85,7 +81,7 @@ public interface MyProxy extends ProxyPlace<CarsPresenter> {
CarsPresenter(EventBus eventBus,
MyView view,
MyProxy proxy,
DispatchAsync dispatcher,
RestDispatch dispatcher,
CarService carService,
PlaceManager placeManager,
CarProxyFactory carProxyFactory) {
Expand Down Expand Up @@ -121,25 +117,24 @@ public void onCreate() {

@Override
public void fetchData(final int offset, int limit) {
dispatcher.execute(carService.getCars(offset, limit), new AbstractAsyncCallback<GetResults<CarDto>>() {
dispatcher.execute(carService.getCars(offset, limit), new AbstractAsyncCallback<List<CarDto>>() {
@Override
public void onSuccess(GetResults<CarDto> result) {
getView().displayCars(offset, result.getResults());
public void onSuccess(List<CarDto> cars) {
getView().displayCars(offset, cars);
}
});
}

@Override
public void onDelete(CarDto carDto) {
dispatcher.execute(carService.delete(carDto.getId()),
new ErrorHandlerAsyncCallback<NoResult>(this) {
@Override
public void onSuccess(NoResult noResult) {
fetchDataForDisplay();

getView().setCarsCount(getView().getCarDisplay().getRowCount() - 1);
}
});
dispatcher.execute(carService.delete(carDto.getId()), new ErrorHandlerAsyncCallback<Void>(this) {
@Override
public void onSuccess(Void nothing) {
fetchDataForDisplay();

getView().setCarsCount(getView().getCarDisplay().getRowCount() - 1);
}
});
}

@ProxyEvent
Expand All @@ -164,10 +159,10 @@ protected void onReveal() {
ChangeActionBarEvent.fire(this, Arrays.asList(ActionType.ADD), true);
getView().initDataProvider();

dispatcher.execute(carService.getCarsCount(), new AbstractAsyncCallback<GetResult<NumberDto<Integer>>>() {
dispatcher.execute(carService.getCarsCount(), new AbstractAsyncCallback<Integer>() {
@Override
public void onSuccess(GetResult<NumberDto<Integer>> result) {
getView().setCarsCount(result.getResult().getNumber());
public void onSuccess(Integer result) {
getView().setCarsCount(result);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,9 @@
import com.gwtplatform.carstore.client.rest.ManufacturerService;
import com.gwtplatform.carstore.client.util.AbstractAsyncCallback;
import com.gwtplatform.carstore.client.util.ErrorHandlerAsyncCallback;
import com.gwtplatform.carstore.shared.dispatch.GetResult;
import com.gwtplatform.carstore.shared.dispatch.GetResults;
import com.gwtplatform.carstore.shared.dto.CarDto;
import com.gwtplatform.carstore.shared.dto.ManufacturerDto;
import com.gwtplatform.dispatch.shared.DispatchAsync;
import com.gwtplatform.dispatch.shared.NoResult;
import com.gwtplatform.dispatch.rest.shared.RestDispatch;
import com.gwtplatform.mvp.client.HasUiHandlers;
import com.gwtplatform.mvp.client.Presenter;
import com.gwtplatform.mvp.client.View;
Expand Down Expand Up @@ -74,7 +71,7 @@ public interface MyProxy extends ProxyPlace<CarPresenter> {
private final CarService carService;
private final ManufacturerService manufacturerService;
private final CarMessages messages;
private final DispatchAsync dispatcher;
private final RestDispatch dispatcher;
private final PlaceManager placeManager;
private final CarProxyFactory carProxyFactory;

Expand All @@ -83,7 +80,7 @@ public interface MyProxy extends ProxyPlace<CarPresenter> {
@Inject
public CarPresenter(EventBus eventBus,
MyView view,
DispatchAsync dispatcher,
RestDispatch dispatcher,
CarService carService,
ManufacturerService manufacturerService,
PlaceManager placeManager,
Expand Down Expand Up @@ -131,10 +128,10 @@ public void onCancel() {

@Override
public void onSave(final CarDto carDto) {
dispatcher.execute(carService.saveOrCreate(carDto), new ErrorHandlerAsyncCallback<GetResult<CarDto>>(this) {
dispatcher.execute(carService.saveOrCreate(carDto), new ErrorHandlerAsyncCallback<CarDto>(this) {
@Override
public void onSuccess(GetResult<CarDto> result) {
onCarSaved(carDto, result.getResult());
public void onSuccess(CarDto newCar) {
onCarSaved(carDto, newCar);
}
});
}
Expand Down Expand Up @@ -166,13 +163,12 @@ protected void onBind() {

@Override
protected void onReveal() {
dispatcher.execute(manufacturerService.getManufacturers(),
new AbstractAsyncCallback<GetResults<ManufacturerDto>>() {
@Override
public void onSuccess(GetResults<ManufacturerDto> result) {
onGetManufacturerSuccess(result.getResults());
}
});
dispatcher.execute(manufacturerService.getManufacturers(), new AbstractAsyncCallback<List<ManufacturerDto>>() {
@Override
public void onSuccess(List<ManufacturerDto> manufacturers) {
onGetManufacturerSuccess(manufacturers);
}
});

Boolean createNew = placeManager.getCurrentPlaceRequest().matchesNameToken(NameTokens.newCar);
List<ActionType> actions;
Expand Down Expand Up @@ -214,13 +210,12 @@ private void onCarSaved(CarDto oldCar, CarDto newCar) {
private void onDeleteCar() {
Boolean confirm = Window.confirm("Are you sure you want to delete " + carDto.getModel() + "?");
if (confirm) {
dispatcher.execute(carService.delete(carDto.getId()),
new ErrorHandlerAsyncCallback<NoResult>(this) {
@Override
public void onSuccess(NoResult noResult) {
NavigationTabEvent.fireClose(CarPresenter.this, CarPresenter.this);
}
});
dispatcher.execute(carService.delete(carDto.getId()), new ErrorHandlerAsyncCallback<Void>(this) {
@Override
public void onSuccess(Void nothing) {
NavigationTabEvent.fireClose(CarPresenter.this, CarPresenter.this);
}
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import com.gwtplatform.carstore.shared.dispatch.LogInResult;
import com.gwtplatform.carstore.shared.dto.ActionType;
import com.gwtplatform.carstore.shared.dto.CurrentUserDto;
import com.gwtplatform.dispatch.shared.DispatchAsync;
import com.gwtplatform.dispatch.rest.shared.RestDispatch;
import com.gwtplatform.mvp.client.HasUiHandlers;
import com.gwtplatform.mvp.client.Presenter;
import com.gwtplatform.mvp.client.View;
Expand Down Expand Up @@ -69,7 +69,7 @@ public interface MyProxy extends ProxyPlace<LoginPresenter> {

private static final Logger logger = Logger.getLogger(LoginPresenter.class.getName());
private final PlaceManager placeManager;
private final DispatchAsync dispatchAsync;
private final RestDispatch dispatchAsync;
private final SessionService sessionService;
private final CurrentUser currentUser;
private final LoginMessages messages;
Expand All @@ -79,7 +79,7 @@ public interface MyProxy extends ProxyPlace<LoginPresenter> {
MyView view,
MyProxy proxy,
PlaceManager placeManager,
DispatchAsync dispatchAsync,
RestDispatch dispatchAsync,
SessionService sessionService,
CurrentUser currentUser,
LoginMessages messages) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@
import com.gwtplatform.carstore.client.security.LoggedInGatekeeper;
import com.gwtplatform.carstore.client.util.AbstractAsyncCallback;
import com.gwtplatform.carstore.client.util.ErrorHandlerAsyncCallback;
import com.gwtplatform.carstore.shared.dispatch.GetResult;
import com.gwtplatform.carstore.shared.dto.ManufacturerDto;
import com.gwtplatform.dispatch.shared.DispatchAsync;
import com.gwtplatform.dispatch.shared.NoResult;
import com.gwtplatform.dispatch.rest.shared.RestDispatch;
import com.gwtplatform.mvp.client.HasUiHandlers;
import com.gwtplatform.mvp.client.Presenter;
import com.gwtplatform.mvp.client.View;
Expand Down Expand Up @@ -71,7 +69,7 @@ public interface MyView extends View, HasUiHandlers<ManufacturerDetailUiHandlers
public interface MyProxy extends ProxyPlace<ManufacturerDetailPresenter> {
}

private final DispatchAsync dispatcher;
private final RestDispatch dispatcher;
private final ManufacturerService manufacturerService;
private final PlaceManager placeManager;
private final EditManufacturerMessages messages;
Expand All @@ -83,7 +81,7 @@ public interface MyProxy extends ProxyPlace<ManufacturerDetailPresenter> {
ManufacturerDetailPresenter(EventBus eventBus,
MyView view,
MyProxy proxy,
DispatchAsync dispatcher,
RestDispatch dispatcher,
ManufacturerService manufacturerService,
PlaceManager placeManager,
EditManufacturerMessages messages) {
Expand All @@ -104,10 +102,10 @@ public void prepareFromRequest(PlaceRequest request) {

if (!createNew) {
Long id = Long.parseLong(param);
dispatcher.execute(manufacturerService.get(id), new AbstractAsyncCallback<GetResult<ManufacturerDto>>() {
dispatcher.execute(manufacturerService.get(id), new AbstractAsyncCallback<ManufacturerDto>() {
@Override
public void onSuccess(GetResult<ManufacturerDto> result) {
currentManufacturer = result.getResult();
public void onSuccess(ManufacturerDto manufacturer) {
currentManufacturer = manufacturer;
getView().edit(currentManufacturer);
}
});
Expand Down Expand Up @@ -142,9 +140,9 @@ public void onActionEvent(ActionBarEvent event) {
@Override
public void onSave(ManufacturerDto manufacturerDto) {
dispatcher.execute(manufacturerService.saveOrCreate(manufacturerDto),
new ErrorHandlerAsyncCallback<GetResult<ManufacturerDto>>(this) {
new ErrorHandlerAsyncCallback<ManufacturerDto>(this) {
@Override
public void onSuccess(GetResult<ManufacturerDto> result) {
public void onSuccess(ManufacturerDto savedManufacturerDto) {
DisplayMessageEvent.fire(ManufacturerDetailPresenter.this,
new Message(messages.manufacturerSaved(), MessageStyle.SUCCESS));
placeManager.revealPlace(new Builder().nameToken(NameTokens.getManufacturer()).build());
Expand Down Expand Up @@ -179,9 +177,9 @@ private void deleteManufacturer() {
Boolean confirm = Window.confirm("Are you sure you want to delete " + currentManufacturer.getName() + "?");
if (confirm) {
dispatcher.execute(manufacturerService.delete(currentManufacturer.getId()),
new ErrorHandlerAsyncCallback<NoResult>(this) {
new ErrorHandlerAsyncCallback<Void>(this) {
@Override
public void onSuccess(NoResult noResult) {
public void onSuccess(Void nothing) {
placeManager.revealPlace(new Builder().nameToken(NameTokens.getManufacturer()).build());
}
});
Expand Down
Loading

0 comments on commit 9e0d3ad

Please sign in to comment.