Share
Embed
Make Enterprise Applications development easy, fast and reliable: productive-GWT.
GWTcon
January 07, 2017
Transcript
28 slides
-
Make Enterprise Applications development easy, fast and reliable: productive-GWT. By
and Luca Masini Alberto Mancini -
Speakers Luca Masini Software Engineer Architect Developer @lmasini - [email protected]
Alberto Mancini Freelance Software Developer Linux Sysadmin GWT Artisan #Javascript #Java @usernamelibero - [email protected] Thanks to and Rosanna Rinaldi Francesca Tosi -
Motivating forces We need A programming model that can lower
the barrier of using GWT as the GUI framework... ..helped by an archetype for fast startup of new enterprise application project -
Target A coherent layout Integration with an external provisioning system
for user and application data Simplified REST call GWT Widgets that let the developer ignore the underlying HTML5/CSS This was done gluing together some carefully chosen available frameworks. -
Why not the sexy XXX framework ? Here a snippet
of code using ProductiveGWT @MenuEntry(text = "Catalogue") //Integration with GUI... @RestrictedAccess(roles = SecurityRoles.RESPONSABILE) ///...and Security @Page // Navigation integrated with browser history public class CataloguePage extends AbstractRicercaView<Catalogue> { // Declarative and type-safe UI-Binder interface Binder extends UiBinder<VerticalPanel, CataloguePage> { Binder INSTANCE = GWT.create(Binder.class); } @Inject // Service call interface Caller<CatalogueService> catalogueServiceCaller; // My Business code -
ReactJS It took 20 years to escape from JSP and
ASP. Now Facebook has invented JSX, so that we can mix JavaScript and HTML: But Flux is very interesting !!! class App extends React.Component { render() { var i = 1; return ( <div> <h1>{i == 1 ? 'True!' : 'False'}</h1> </div> ); } } -
Tech choices GWT 2.8 (of course) GWT Material 1.6 (soon
2.0) Errai Framework 4 -
GWT 2.8 Java 8 is cool but.... 2.8 compile time
is higher than in 2.7 More memory usage (+80%) Variables name now are even more cryptically and still no support from Source Maps -
GWT Material Chosen because it's ready to use in production
now No Google's Material Design Light, we want GWT Widgets and few CSS3/HTML5 (distraction free coding) We are interested observers of gwt-polymer project... ...and the brand new GXT5 -
Errai Framework Dagger 2 is ligther and can wire applications
like Errai CDI does, but... ...with Errai CDI we use the same programming model on client code and server code We also used a lot "Errai Navigation", "Errai Security" and "Errai JAX-RS" -
General structure of the project Archetype Generation of the project
Errai Wiring, navigation, security, straightforward JAX Menu generation Java Annotation Processing (APT) -
Archetype @MenuEntry(text = "Home, default page", order = 0) @RestrictedAccess(roles
= {"gwtcon-admin", "gwtcon-user"}) @Page(role = DefaultPage.class, path = "/home") public class Home extends HTML { @Inject BootstrapData bootstapData; @PageShowing private void setup() { } } -
ERRAI Framework Errai Navigation easy, annotation based, history, typed inter
apps (page) transitions; Errai Security clean, annotation based, authorization, SecurityContext; Errai JAX-RS REST-based Web services client-side interceptors Errai IOC @Inject @Alternative, customization -
ERRAI Framework Errai Navigation to ... declare page with Page
Annotation over the classes @Page(role = DefaultPage.class, path = "/home") public class Home extends HTML {...} navigate between pages @Inject TransitionTo<Samples> transition; ... transition.go(); -
ERRAI Framework Errai Security to ... restrict access through Rescricted
Access Annotation over: Pages and UI elements @Page(role = DefaultPage.class, path = "/home") @RestrictedAccess(roles = {"gwtcon-admin", "gwtcon-user"}) public class Home extends HTML { @RestrictedAccess(roles = {"gwtcon-admin"}) @Inject @DataField private Button sendLogo; ... } REST resources @GET @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) @RestrictedAccess(roles = "gwtcon-admin") public Customer find(@PathParam("id") long id); -
ERRAI Framework IOC to ... obtain user informations and application
data through DI @Inject BootstrapData bootstrapData; ... Window.alert(bootstrapData.getUserInfo().getUsername()); ... Window.alert(bootstrapData.getApplicationName()); Window.alert(bootstrapData.getServerName()); -
ERRAI Framework IOC and Alternative to ... customize the SplashPage
through an instance of AppView @Inject AppView appView; ... appView.getSplashScreen().setText("Splash … "); customize the SplashPage creating an alternative for SplashScreen and activating it into ErraiApp.properties @Alternative public class CustomSplashScreen implements SplashScreen {...} errai.ioc.enabled.alternatives= com.gwtcon.productivegwt.client.ui.CustomSplashScreen -
ERRAI Framework Intercerptors to ... handle Async Callback through interceptors
over REST resources @GET @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) @InterceptedCall(RequestInterceptor.class) public Customer find(@PathParam("id") long id); -
Annotation The processor Hook on all classes @AutoService(Processor.class) @SupportedAnnotationTypes(value =
{"*"}) process, cache and emit @Override public boolean process(Set< ? extends TypeElement> elements, RoundEnvironment env) { if (env.processingOver()) { //last round, we can write //generate the 'menu' with the inforations from the pages-database } else { //.... enlist in the pages-database the current page }