Skip to content

Commit

Permalink
* added using code splitting in module - issue #1
Browse files Browse the repository at this point in the history
* added missed copyright headers to several files
  • Loading branch information
domax committed Sep 15, 2014
1 parent 7c1cf55 commit c0394da
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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<T extends PresenterWidget<?>> {

private final AsyncProvider<T> provider;

@Inject
public PresenterWidgetFactory(AsyncProvider<T> provider) {
this.provider = provider;
}

public void get(AsyncCallback<T> callback) {
provider.get(callback);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -42,21 +43,37 @@ public interface MyView extends View, HasUiHandlers<ContentUiHandlers> {
void setBanner(String banner);
}

private final RolesPresenter nestedPresenter;
private final PresenterWidgetFactory<RolesPresenter> rolesPresenterFactory;
private RolesPresenter rolesPresenter;

@Inject
public ContentPresenter(final EventBus eventBus, final MyView view, RolesPresenter nestedPresenter) {
public ContentPresenter(final EventBus eventBus, final MyView view,
PresenterWidgetFactory<RolesPresenter> rolesPresenterFactory) {
super(eventBus, view);
getView().setUiHandlers(this);
this.nestedPresenter = nestedPresenter;
this.rolesPresenterFactory = rolesPresenterFactory;
LOG.info("ContentPresenter: instantiated");
}

@Override
protected void onBind() {
super.onBind();
LOG.info("ContentPresenter.onBind");
setInSlot(SLOT_NESTED, nestedPresenter);
rolesPresenterFactory.get(new AsyncCallback<RolesPresenter>() {

@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
Expand Down

0 comments on commit c0394da

Please sign in to comment.