Skip to content

Commit

Permalink
* added team roles service;
Browse files Browse the repository at this point in the history
* added nested widget with animated graph;
* re-factored (simplified) server side packages;
  • Loading branch information
domax committed Sep 14, 2014
1 parent eeadb27 commit dd974e2
Show file tree
Hide file tree
Showing 46 changed files with 957 additions and 100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.gwt.dynamic.host.client.main.MainLayout;
import org.gwt.dynamic.host.client.module.ModuleLoader;
import org.gwt.dynamic.host.client.services.ModuleServiceConsumer;
import org.gwt.dynamic.host.shared.beans.ModuleBean;
import org.gwt.dynamic.host.shared.ModuleBean;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.LoadEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.gwt.dynamic.common.client.jso.ModuleInfo;
import org.gwt.dynamic.common.client.util.BatchRunner;
import org.gwt.dynamic.common.client.util.BatchRunner.CommandSimple;
import org.gwt.dynamic.host.shared.beans.ModuleBean;
import org.gwt.dynamic.host.shared.ModuleBean;

import com.google.gwt.user.client.rpc.AsyncCallback;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.gwt.dynamic.common.client.features.FeatureCommonConst;
import org.gwt.dynamic.common.client.features.FeatureProvider;
import org.gwt.dynamic.common.shared.Utils;
import org.gwt.dynamic.host.shared.beans.ModuleBean;
import org.gwt.dynamic.host.shared.ModuleBean;

import com.google.gwt.dom.client.Document;
import com.google.gwt.event.dom.client.DomEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import java.util.List;

import org.gwt.dynamic.host.shared.beans.ModuleBean;
import org.gwt.dynamic.host.shared.ModuleBean;

import com.google.gwt.core.shared.GWT;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
import java.util.logging.Logger;

import static org.gwt.dynamic.common.shared.Utils.*;
import org.gwt.dynamic.host.shared.beans.ModuleBean;

import org.gwt.dynamic.host.shared.ModuleBean;

import com.google.gwt.core.client.ScriptInjector;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

import org.fusesource.restygwt.client.MethodCallback;
import org.fusesource.restygwt.client.RestService;
import org.gwt.dynamic.host.shared.beans.ModuleBean;
import org.gwt.dynamic.host.shared.services.ModuleServiceConst;
import org.gwt.dynamic.host.shared.ModuleBean;
import org.gwt.dynamic.host.shared.ModuleServiceConst;

public interface ModuleRestService extends RestService, ModuleServiceConst {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import org.fusesource.restygwt.client.MethodCallback;
import org.gwt.dynamic.common.client.services.AbstractServiceConsumer;
import org.gwt.dynamic.host.shared.beans.ModuleBean;
import org.gwt.dynamic.host.shared.ModuleBean;

import com.google.gwt.core.shared.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.gwt.dynamic.host.server.rest;
package org.gwt.dynamic.host.server;

import java.util.List;
import java.util.logging.Level;
Expand All @@ -28,8 +28,8 @@
import org.codehaus.jackson.type.TypeReference;
import org.gwt.dynamic.common.server.rest.AbstractServiceProvider;
import org.gwt.dynamic.common.shared.Utils;
import org.gwt.dynamic.host.shared.beans.ModuleBean;
import org.gwt.dynamic.host.shared.services.ModuleServiceConst;
import org.gwt.dynamic.host.shared.ModuleBean;
import org.gwt.dynamic.host.shared.ModuleServiceConst;

@Path("/")
public class ModuleServiceProvider extends AbstractServiceProvider implements ModuleServiceConst {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.gwt.dynamic.host.shared.beans;
package org.gwt.dynamic.host.shared;

public class ModuleBean {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.gwt.dynamic.host.shared.services;
package org.gwt.dynamic.host.shared;

public interface ModuleServiceConst {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>org.gwt.dynamic.host.server.rest</param-value>
<param-value>org.gwt.dynamic.host.server</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.gwt.dynamic.common.client.features.ModuleInfoFeatureProvider;
import org.gwt.dynamic.common.client.module.AbstractModule;
import org.gwt.dynamic.module.foo.client.services.FooServiceConsumer;
import org.gwt.dynamic.module.foo.shared.beans.FooData;
import org.gwt.dynamic.module.foo.shared.FooData;

import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Widget;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import java.util.logging.Logger;

import org.gwt.dynamic.module.foo.shared.beans.FooData;
import org.gwt.dynamic.module.foo.shared.FooData;

import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.CssResource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

import org.fusesource.restygwt.client.MethodCallback;
import org.fusesource.restygwt.client.RestService;
import org.gwt.dynamic.module.foo.shared.beans.FooData;
import org.gwt.dynamic.module.foo.shared.services.FooServiceConst;
import org.gwt.dynamic.module.foo.shared.FooData;
import org.gwt.dynamic.module.foo.shared.FooServiceConst;

@Path(FooServiceConst.PATH)
public interface FooRestService extends RestService, FooServiceConst {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import org.fusesource.restygwt.client.MethodCallback;
import org.gwt.dynamic.common.client.services.AbstractServiceConsumer;
import org.gwt.dynamic.module.foo.shared.beans.FooData;
import org.gwt.dynamic.module.foo.shared.FooData;

import com.google.gwt.core.shared.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.gwt.dynamic.module.foo.server.rest;
package org.gwt.dynamic.module.foo.server;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -31,8 +31,8 @@
import javax.ws.rs.core.MediaType;

import org.gwt.dynamic.common.server.rest.AbstractServiceProvider;
import org.gwt.dynamic.module.foo.shared.beans.FooData;
import org.gwt.dynamic.module.foo.shared.services.FooServiceConst;
import org.gwt.dynamic.module.foo.shared.FooData;
import org.gwt.dynamic.module.foo.shared.FooServiceConst;

@Path("/" + FooServiceConst.PATH)
public class FooServiceProvider extends AbstractServiceProvider implements FooServiceConst {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.gwt.dynamic.module.foo.shared.beans;
package org.gwt.dynamic.module.foo.shared;

public class FooData {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.gwt.dynamic.module.foo.shared.services;
package org.gwt.dynamic.module.foo.shared;

public interface FooServiceConst {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>org.gwt.dynamic.module.foo.server.rest</param-value>
<param-value>org.gwt.dynamic.module.foo.server</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
Expand Down
12 changes: 12 additions & 0 deletions gwt-dynamic-main/gwt-dynamic-module-gwtp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@
<artifactId>gin</artifactId>
<version>${gin.version}</version>
</dependency>
<dependency>
<groupId>com.github.gwtd3</groupId>
<artifactId>gwt-d3-js</artifactId>
<version>3.3.11</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.gwtd3</groupId>
<artifactId>gwt-d3-api</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

import org.gwt.dynamic.module.gwtp.client.application.content.ContentPresenter;
import org.gwt.dynamic.module.gwtp.client.application.content.ContentView;
import org.gwt.dynamic.module.gwtp.client.application.nested.NestedPresenter;
import org.gwt.dynamic.module.gwtp.client.application.nested.NestedView;
import org.gwt.dynamic.module.gwtp.client.application.roles.RolesPresenter;
import org.gwt.dynamic.module.gwtp.client.application.roles.RolesView;

import com.google.inject.Singleton;
import com.google.web.bindery.event.shared.EventBus;
Expand All @@ -41,8 +41,8 @@ protected void configure() {
ContentPresenter.MyView.class,
ContentView.class);
bindSingletonPresenterWidget(
NestedPresenter.class,
NestedPresenter.MyView.class,
NestedView.class);
RolesPresenter.class,
RolesPresenter.MyView.class,
RolesView.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public class FeatureController implements FeatureCommonConst {

@Inject
public FeatureController(EventBus eventBus) {
new ModuleInfoFeatureProvider("GWTP Module", "This module is built using GWTP framework.");
new ModuleInfoFeatureProvider("GWTP Module",
"This module is built using GWTP framework. The graph in nested widget is just for fun ;)");
new ModuleContentFeatureProvider(new ViewHandler() {
@Override
public Widget getView() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@
*/
package org.gwt.dynamic.module.gwtp.client.application.content;

import java.util.Set;
import java.util.logging.Logger;

import org.gwt.dynamic.module.gwtp.client.application.nested.NestedPresenter;
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;
import org.gwt.dynamic.module.gwtp.shared.RoleBean;

import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.inject.Inject;
import com.google.web.bindery.event.shared.EventBus;
import com.gwtplatform.mvp.client.HasUiHandlers;
Expand All @@ -30,12 +35,14 @@ public class ContentPresenter extends ModulePresenter<ContentPresenter.MyView> i
private static final Logger LOG = Logger.getLogger(ContentPresenter.class.getName());
public static final Object SLOT_NESTED = new Object();

public interface MyView extends View, HasUiHandlers<ContentUiHandlers> {}
public interface MyView extends View, HasUiHandlers<ContentUiHandlers> {
void setError(String error);
}

private final NestedPresenter nestedPresenter;
private final RolesPresenter nestedPresenter;

@Inject
public ContentPresenter(final EventBus eventBus, final MyView view, NestedPresenter nestedPresenter) {
public ContentPresenter(final EventBus eventBus, final MyView view, RolesPresenter nestedPresenter) {
super(eventBus, view);
getView().setUiHandlers(this);
this.nestedPresenter = nestedPresenter;
Expand All @@ -53,6 +60,21 @@ protected void onBind() {
protected void onReveal() {
super.onReveal();
LOG.info("ContentPresenter.onReveal");
RoleServiceConsumer.get().getRoles(new AsyncCallback<Set<RoleBean>>() {

@Override
public void onSuccess(Set<RoleBean> result) {
LOG.info("ContentPresenter#getRoles#onFailure");
LOG.fine("ContentPresenter#getRoles#onFailure: result=" + result);
RolesLoadedEvent.fire(ContentPresenter.this, result);
}

@Override
public void onFailure(Throwable caught) {
LOG.severe("ContentPresenter#getRoles#onFailure: caught=" + caught.getMessage());
getView().setError("Error occurred: " + caught.getMessage());
}
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
import com.google.gwt.resources.client.CssResource;
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.Label;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
Expand All @@ -33,9 +35,13 @@ public class ContentView extends ViewWithUiHandlers<ContentUiHandlers>

interface Binder extends UiBinder<Widget, ContentView> {}

public interface InnerCss extends CssResource {}
public interface InnerCss extends CssResource {
String error();
}

@UiField public static InnerCss style;
@UiField FlowPanel main;
@UiField Label message;
@UiField SimplePanel content;

@Inject
Expand All @@ -51,4 +57,11 @@ public void setInSlot(Object slot, IsWidget content) {
this.content.setWidget(content);
else super.setInSlot(slot, content);
}

@Override
public void setError(String error) {
LOG.info("HomeView.setError: error=" + error);
message.setText(error);
main.addStyleName(style.error());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,36 @@
xmlns:g="urn:import:com.google.gwt.user.client.ui">

<ui:style type="org.gwt.dynamic.module.gwtp.client.application.content.ContentView.InnerCss">
.main {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}

.message {
display: none;
}
.error .message {
display: block;
color: red;
}

.content {
position: abslute;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.error .content {
display: none;
}
</ui:style>

<g:SimplePanel ui:field="content" styleName="{style.content}" />
<g:FlowPanel ui:field="main" styleName="{style.main}">
<g:Label ui:field="message" styleName="{style.message}" />
<g:SimplePanel ui:field="content" styleName="{style.content}" />
</g:FlowPanel>
</ui:UiBinder>
Loading

0 comments on commit dd974e2

Please sign in to comment.