24
THE POWER OF PERSPECTIVE Open Admin - GWT Java Track Brian Polster Credera Copyright © 2011 Credera. All Rights Reserved.

Open Admin

Embed Size (px)

DESCRIPTION

Open Admin is an open source framework for building administration programs based on GWT. The framework provides the ability to easily integrate Spring Security, SmartGWT, and JPA. Open Admin is a component of the Broadleaf Commerce framework and will be released to the open source community as part of BroadleafComerce version 1.5.

Citation preview

Page 1: Open Admin

THE POWER OF PERSPECTIVE

Open Admin - GWTJava Track

Brian Polster

Credera

Copyright © 2011 Credera. All Rights Reserved.

Page 2: Open Admin

THE POWER OF PERSPECTIVE- 2 -Copyright © 2011 Credera.

All Rights Reserved.

About the Speaker

Brian Polster

· Lead the Java Practice at Credera for past 5½ years

· Former Architect at American Airlines (www.aa.com)

· Founder of Broadleaf Commerce (eCommerce framework based on open source technologies)

www.credera.com

Page 3: Open Admin

THE POWER OF PERSPECTIVE- 3 -Copyright © 2011 Credera.

All Rights Reserved.

Agenda· What is Open Admin

· GWT

– Overview

– Example

· Smart-GWT Primer

· Build a simple Open Admin Module

www.credera.com

Page 4: Open Admin

THE POWER OF PERSPECTIVE- 4 -Copyright © 2011 Credera.

All Rights Reserved.

What is Open Admin?

· Component / Outcome of Broadleaf Commerce

– Built in Security

– Pluggable Module Metaphor

– Sandbox capability

– Release 1 Target – September

· Based on common open source components

– GWT

– Smart GWT

– Spring Security

– JPA / Hibernate

www.credera.com

Page 5: Open Admin

THE POWER OF PERSPECTIVE- 5 -Copyright © 2011 Credera.

All Rights Reserved.

www.credera.comDemo – (Broadleaf Commerce Admin)

Page 6: Open Admin

THE POWER OF PERSPECTIVE- 6 -Copyright © 2011 Credera.

All Rights Reserved.

www.credera.com

DemoBroadleaf Commerce Admin

Page 7: Open Admin

THE POWER OF PERSPECTIVE- 7 -Copyright © 2011 Credera.

All Rights Reserved.

GWT (Google Web Toolkit)

Key Benefits (according to me ….)

· Emits JavaScript from Java

· Allows debugging of JavaScript using breakpoints in Java code

· RPC and GWT-RPC

· Shipped with component library that isextensible through JSNI

www.credera.com

Page 8: Open Admin

THE POWER OF PERSPECTIVE- 8 -Copyright © 2011 Credera.

All Rights Reserved.

www.credera.com

Google has good tutorials on GWT.

http://code.google.com/webtoolkit/gettingstarted.html

The sample provides a good background on the following:

· Google Compiler Configuration file (e.g. *.gwt.xml)

· HTML start page

· Entry Point Class(es)

· GWT Debugger

· GWT-RPC

GWT – Sample Application

Page 9: Open Admin

THE POWER OF PERSPECTIVE- 9 -Copyright © 2011 Credera.

All Rights Reserved.

www.credera.com

DemoGWT

Page 10: Open Admin

THE POWER OF PERSPECTIVE- 10 -Copyright © 2011 Credera.

All Rights Reserved.

Smart GWT

· GWT wrapper over the Smart Client JavaScript library

· Provides hooks for data source interaction

· LPGL license for mostwidgets – company sellssupport and advancedfeatures

http://www.smartclient.com/product/smartgwt.jsp

www.credera.com

Page 11: Open Admin

THE POWER OF PERSPECTIVE- 11 -Copyright © 2011 Credera.

All Rights Reserved.

www.credera.com

DemoSmart GWT Showcase

Page 12: Open Admin

THE POWER OF PERSPECTIVE- 12 -Copyright © 2011 Credera.

All Rights Reserved.

Open Admin Terminology

www.credera.com

Module

Section

Views

Page 13: Open Admin

THE POWER OF PERSPECTIVE- 13 -Copyright © 2011 Credera.

All Rights Reserved.

Module

Section(s)

Open Admin Terminology

www.credera.com

View(s)

List Grid

Presenter

Event Handlers

Model

Order

Button

Form

Events

Customer

Datasource

Page 14: Open Admin

THE POWER OF PERSPECTIVE- 14 -Copyright © 2011 Credera.

All Rights Reserved.

Simple Example - Step 1 of 3: Building The View

www.credera.com

public class SimpleView extends HLayout implements Instantiable, Display { public SimpleView() { setHeight100(); setWidth100(); }

public void build(DataSource entityDataSource) { new IButton("Click Me"); button.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { SC.say("Hello, World from smartGWT"); } });

addMember(button); }

Page 15: Open Admin

THE POWER OF PERSPECTIVE- 15 -Copyright © 2011 Credera.

All Rights Reserved.

Simple Example - Step 2 of 3: Creating the Open Admin Module

public class SimpleModule extends AbstractModule {

public void onModuleLoad() { setModuleTitle("Tech Fest Module"); List<String> roles= new ArrayList<String>(); roles.add("ROLE_TECH_FEST_USER”); roles.add("ROLE_ADMIN");

setSection("Simple Example”, "viewKey”, SimpleView.class.getName(), roles);

registerModule();

}

}

www.credera.com

Page 16: Open Admin

THE POWER OF PERSPECTIVE- 16 -Copyright © 2011 Credera.

All Rights Reserved.

Simple Example - Step 3: Configuring the GWT Complier

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE module PUBLIC "-//Google Inc. <...> <module> <inherits name="com.google.gwt.user.User" /> <inherits name="org.broadleafcommerce.openadmin.openadmin" />

<entry-point class="techfest.client.simple.SimpleModule" /> <source path="client" />

</module>

Also need to add reference to the project *.gwt.xml file.

www.credera.com

Page 17: Open Admin

THE POWER OF PERSPECTIVE- 17 -Copyright © 2011 Credera.

All Rights Reserved.

www.credera.com

DemoSecurity

Page 18: Open Admin

THE POWER OF PERSPECTIVE- 18 -Copyright © 2011 Credera.

All Rights Reserved.

Dynamic Form Generation

· The list grids and entry forms are generated automatically from the JPA and OpenAdmin configuration.

@Column(name = "MODEL”) // JPA @AdminPresentation // Open Admin (friendlyName="Product Model", order=4, group="Product Description", prominent=true)

· Open Admin field configuration can be done via an XML file or inline in the java class.

· Other attributes include: readOnly, securityLevel, and validation

www.credera.com

Page 19: Open Admin

THE POWER OF PERSPECTIVE- 19 -Copyright © 2011 Credera.

All Rights Reserved.

www.credera.com

DemoReview Source for Order and Privilege

Page 20: Open Admin

THE POWER OF PERSPECTIVE- 20 -Copyright © 2011 Credera.

All Rights Reserved.

Recap the Steps for Adding a JPA Data Driven Section

· Create the view by extend BasicListDetailView

– Setting the title fields

– Set the view handle (prefix)

· Create the presenter by extending DynamicEntityPresenter

– Specify the grid fields (optional)

– Tie-in the associated DataSourceFactory

· Create the DataSourceFactory by extending SimpleDataSourceFactory

– Set the class name for your JPA configured class

· Add a new section to your module that references the view and presenter.

www.credera.com

Page 21: Open Admin

THE POWER OF PERSPECTIVE- 21 -Copyright © 2011 Credera.

All Rights Reserved.

Summary

Benefits of Open Admin

– Helper classes to bridge SmartGWT DataSources and JPA

– Simple “Out of Box” view and presenter classes that make building a rich UI easy

– Configurable security based on Spring Security

Announcement …

– BLC Content Management Content targeting, structured content,

templated page development

www.credera.com

Page 22: Open Admin

THE POWER OF PERSPECTIVE- 22 -Copyright © 2011 Credera.

All Rights Reserved.

· Our Company

– Full-service business and technology consulting firm

– Provide business and technology solutions that offer measurable value to our clients

– Deliver value by leveraging our people’s accumulated industry and management experience with their deep technical expertise

– Established in 1999

– Offices in Dallas, Austin, Denver

· Our Services

– Management Consulting

– Technology Solutions

– Business Intelligence

· Our People

– Credera’s professionals possess a unique combination of deep technical expertise with extensive business backgrounds

– Backgrounds include business, technology, and strategy management consulting with some of the most well-known and respected consulting firms in the world

– Have served many influential corporations in a variety of industries over the past 20 years

· Sample Clients

Credera is a Business and Technology Consulting Firm that Focuses on Leveraging Proven Technologies to Enable our Clients Business Strategy

www.credera.com

Page 23: Open Admin

THE POWER OF PERSPECTIVE- 23 -Copyright © 2011 Credera.

All Rights Reserved.

Q&A

www.credera.com

Thank you for attending!

Contact Information:Brian Polster

[email protected]

Twitter: polster

Page 24: Open Admin

THE POWER OF PERSPECTIVE

Smart GWT & Open Admin

Brian PolsterCredera

Copyright © 2011 Credera. All Rights Reserved.