diff --git a/gwt-dynamic-main/gwt-dynamic-common/src/main/java/org/gwt/dynamic/common/server/CrossDomainFilter.java b/gwt-dynamic-main/gwt-dynamic-common/src/main/java/org/gwt/dynamic/common/server/CrossDomainFilter.java index 393173b..d726868 100644 --- a/gwt-dynamic-main/gwt-dynamic-common/src/main/java/org/gwt/dynamic/common/server/CrossDomainFilter.java +++ b/gwt-dynamic-main/gwt-dynamic-common/src/main/java/org/gwt/dynamic/common/server/CrossDomainFilter.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 Maxim Dominichenko + * + * Licensed under The MIT License (MIT) (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * https://github.com/domax/gwt-dynamic-plugins/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ package org.gwt.dynamic.common.server; import com.sun.jersey.spi.container.ContainerRequest; diff --git a/gwt-dynamic-main/gwt-dynamic-common/src/test/java/org/gwt/dynamic/common/client/util/BatchRunnerTestGWT.java b/gwt-dynamic-main/gwt-dynamic-common/src/test/java/org/gwt/dynamic/common/client/util/BatchRunnerTestGWT.java index c62b9ee..962b7bd 100644 --- a/gwt-dynamic-main/gwt-dynamic-common/src/test/java/org/gwt/dynamic/common/client/util/BatchRunnerTestGWT.java +++ b/gwt-dynamic-main/gwt-dynamic-common/src/test/java/org/gwt/dynamic/common/client/util/BatchRunnerTestGWT.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 Maxim Dominichenko + * + * Licensed under The MIT License (MIT) (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * https://github.com/domax/gwt-dynamic-plugins/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ package org.gwt.dynamic.common.client.util; import java.util.ArrayList; diff --git a/gwt-dynamic-main/gwt-dynamic-host/src/main/java/org/gwt/dynamic/host/client/features/ModuleContentFeatureConsumer.java b/gwt-dynamic-main/gwt-dynamic-host/src/main/java/org/gwt/dynamic/host/client/features/ModuleContentFeatureConsumer.java index aeb94c2..ba6d951 100644 --- a/gwt-dynamic-main/gwt-dynamic-host/src/main/java/org/gwt/dynamic/host/client/features/ModuleContentFeatureConsumer.java +++ b/gwt-dynamic-main/gwt-dynamic-host/src/main/java/org/gwt/dynamic/host/client/features/ModuleContentFeatureConsumer.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 Maxim Dominichenko + * + * Licensed under The MIT License (MIT) (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * https://github.com/domax/gwt-dynamic-plugins/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ package org.gwt.dynamic.host.client.features; import java.util.logging.Logger; diff --git a/gwt-dynamic-main/gwt-dynamic-module-gwtp/src/main/java/org/gwt/dynamic/module/gwtp/client/application/PresenterWidgetFactory.java b/gwt-dynamic-main/gwt-dynamic-module-gwtp/src/main/java/org/gwt/dynamic/module/gwtp/client/application/PresenterWidgetFactory.java new file mode 100644 index 0000000..7178d75 --- /dev/null +++ b/gwt-dynamic-main/gwt-dynamic-module-gwtp/src/main/java/org/gwt/dynamic/module/gwtp/client/application/PresenterWidgetFactory.java @@ -0,0 +1,35 @@ +/* + * Copyright 2014 Maxim Dominichenko + * + * Licensed under The MIT License (MIT) (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * https://github.com/domax/gwt-dynamic-plugins/blob/master/LICENSE + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package org.gwt.dynamic.module.gwtp.client.application; + +import com.google.gwt.inject.client.AsyncProvider; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.inject.Inject; +import com.gwtplatform.mvp.client.PresenterWidget; + +public class PresenterWidgetFactory> { + + private final AsyncProvider provider; + + @Inject + public PresenterWidgetFactory(AsyncProvider provider) { + this.provider = provider; + } + + public void get(AsyncCallback callback) { + provider.get(callback); + } +} diff --git a/gwt-dynamic-main/gwt-dynamic-module-gwtp/src/main/java/org/gwt/dynamic/module/gwtp/client/application/content/ContentPresenter.java b/gwt-dynamic-main/gwt-dynamic-module-gwtp/src/main/java/org/gwt/dynamic/module/gwtp/client/application/content/ContentPresenter.java index 6018e85..df94dd6 100644 --- a/gwt-dynamic-main/gwt-dynamic-module-gwtp/src/main/java/org/gwt/dynamic/module/gwtp/client/application/content/ContentPresenter.java +++ b/gwt-dynamic-main/gwt-dynamic-module-gwtp/src/main/java/org/gwt/dynamic/module/gwtp/client/application/content/ContentPresenter.java @@ -18,6 +18,7 @@ import java.util.Set; import java.util.logging.Logger; +import org.gwt.dynamic.module.gwtp.client.application.PresenterWidgetFactory; import org.gwt.dynamic.module.gwtp.client.application.roles.RolesPresenter; import org.gwt.dynamic.module.gwtp.client.event.RolesLoadedEvent; import org.gwt.dynamic.module.gwtp.client.services.RoleServiceConsumer; @@ -42,13 +43,15 @@ public interface MyView extends View, HasUiHandlers { void setBanner(String banner); } - private final RolesPresenter nestedPresenter; + private final PresenterWidgetFactory rolesPresenterFactory; + private RolesPresenter rolesPresenter; @Inject - public ContentPresenter(final EventBus eventBus, final MyView view, RolesPresenter nestedPresenter) { + public ContentPresenter(final EventBus eventBus, final MyView view, + PresenterWidgetFactory rolesPresenterFactory) { super(eventBus, view); getView().setUiHandlers(this); - this.nestedPresenter = nestedPresenter; + this.rolesPresenterFactory = rolesPresenterFactory; LOG.info("ContentPresenter: instantiated"); } @@ -56,7 +59,21 @@ public ContentPresenter(final EventBus eventBus, final MyView view, RolesPresent protected void onBind() { super.onBind(); LOG.info("ContentPresenter.onBind"); - setInSlot(SLOT_NESTED, nestedPresenter); + rolesPresenterFactory.get(new AsyncCallback() { + + @Override + public void onSuccess(RolesPresenter result) { + LOG.info("ContentPresenter.rolesPresenterFactory#get#onSuccess"); + rolesPresenter = result; + setInSlot(SLOT_NESTED, rolesPresenter); + } + + @Override + public void onFailure(Throwable caught) { + LOG.severe("ContentPresenter.rolesPresenterFactory#get#onFailure: caught=" + caught.getMessage()); + getView().setError("Error occurred: " + caught.getMessage()); + } + }); } @Override