GWT.create 2013: Introduction to GXT

39
Introduction to GXT Colin Alworth / Sencha Inc. [email protected]

description

 

Transcript of GWT.create 2013: Introduction to GXT

Page 1: GWT.create 2013: Introduction to GXT

Introduction to GXT Colin Alworth / Sencha Inc. [email protected]

Page 2: GWT.create 2013: Introduction to GXT

• Native GWT solution with no external JavaScript or 3rd party libraries !

• High performance, customizable UI widgets !

• Well designed, consistent and fully documented source code !

• Built-in support for RPC, RequestFactory, and XML/JSON over AJAX !

• Full theming support with standard CSS !

• Commercial licenses and support available

Sencha GXT - OverviewA Java library for building rich applications with GWT

Page 3: GWT.create 2013: Introduction to GXT

GXT UI WidgetsOut Of The Box

Page 4: GWT.create 2013: Introduction to GXT

GXT ChartsArea, Bar, Column, Pie, Line, & More...

Page 5: GWT.create 2013: Introduction to GXT

• Models & Server Communications !

• Stores & Loaders !

• Templates & Widgets !

• Cells & Cell Widgets !

• UIBinder !

• Layouts !

• Charts

GXT Features

Page 6: GWT.create 2013: Introduction to GXT

Models &

Server Communications

Page 7: GWT.create 2013: Introduction to GXT

• Full support for any POJO • Supports RPC, RequestFactory, AutoBeans • Data Stores take any object type

Models & Server CommunicationsModels

Server Communications

Transport Data Type

RPC POJOs

RequestFactory EntityProxy / AutoBean

RequestBuilder (XML / JSON) Interface / AutoBean

Page 8: GWT.create 2013: Introduction to GXT

• interface PostProperties extends PropertyAccess<Post> {! ValueProvider<Post, String> username();! ValueProvider<Post, String> forum();! ValueProvider<Post, Date> date(); }! // create properties instance via deferred binding PostProperties props = GWT.create(PostProperties.class);! // use value providers new ColumnConfig<Post, String>(props.forum(), 150, "Forum");

Models & Server CommunicationsValue Provider

Page 9: GWT.create 2013: Introduction to GXT

• Allows access to an object’s property • Supports string based path • Supports nested properties • Can be created directly • Can be created by generator

Models & Server CommunicationsValue Provider

Page 10: GWT.create 2013: Introduction to GXT

Stores & Loaders

Page 11: GWT.create 2013: Introduction to GXT

• Stores are client-side collections of data • Filtering and sorting • Change events • Accept any object type • Data widgets are bound to stores

Stores & LoadersStores

ListStore TreeStore

Store

Page 12: GWT.create 2013: Introduction to GXT

• Loader: Builds requests, sends to DataProxy • DataProxy: Makes request to server • DataReader: Translates wire-format to objects • DataWriter: Translates objects to wire-format

Stores & LoadersLoaders

DataProxy DataReader

Loader

Page 13: GWT.create 2013: Introduction to GXT

Stores & LoadersLoader Interactions

Loader DataProxy Server

DataReader

Page 14: GWT.create 2013: Introduction to GXT

• HttpProxy works with GWT RequestBuilder • The type parameters defines the input and return type

Stores & LoadersDataProxy

String path = "data/data.xml";!RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, path);!HttpProxy<ListLoadConfig> proxy = new HttpProxy<ListLoadConfig>(builder);!

Page 15: GWT.create 2013: Introduction to GXT

• Reader “transforms” data • Most String readers use AutoBeans

Stores & LoadersDataReader

reader = new XmlReader<ListLoadResult<Email>, EmailCollection>(factory, EmailCollection.class) {! protected ListLoadResult<Email> createReturnData(Object loadConfig, EmailCollection records) { return new BaseListLoadResult<Email>(records.getValues()); };!};

Page 16: GWT.create 2013: Introduction to GXT

Stores & LoadersDataLoader

loader = new ListLoader<ListLoadConfig, ListLoadResult<Email>>( proxy, reader);!!loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, Email, ListLoadResult<Email>>(store));!!loader.load();

Page 17: GWT.create 2013: Introduction to GXT

• Turns logical data into format to be sent back to server • Reverse behavior of DataReaders • Example use with LoadConfig object sent to server

Stores & LoadersDataWriter

DataWriter

AutoBeanWriter

JsonWriter UrlEncodingWriter XmlWriter

Page 18: GWT.create 2013: Introduction to GXT

Templates & Widgets

Page 19: GWT.create 2013: Introduction to GXT

• Provides compile time templating • Retrieves data from any Java Bean • Produces SafeHtml

Templates & WidgetsXTemplates

Page 20: GWT.create 2013: Introduction to GXT

Templates & WidgetsXTemplates

public interface DataRenderer extends XTemplates { @XTemplate(source = "template.html") public SafeHtml renderTemplate(Person data); }DataRenderer renderer = GWT.create(DataRenderer.class);HTML text = new HTML(renderer.renderTemplate(person));

<p><b>Name:</b> {data.name}</p><p><b>Salary</b>: {data.income:currency}</p><p><b>Kids:</b></p><tpl for="data.kids"><tpl if="age < 100"> <p>{#}. {parent.name}'s kid - {name} - {bday:date("M/d/yyyy")</p></tpl></tpl>

interface ExampleStyle extends CssResource { String searchItem(); } interface ExampleTemplate extends XTemplates { @XTemplate("<div class='{style.searchItem}'>{post}</div>") SafeHtml render(Forum post, ExampleStyle style); }

Page 21: GWT.create 2013: Introduction to GXT

• Fields are cell based and can be used standalone or in data widgets • Fields work with the GWT editing framework

Templates & WidgetsWidgets

Page 22: GWT.create 2013: Introduction to GXT

Cells & Cell Widgets

Page 23: GWT.create 2013: Introduction to GXT

Cells & Cell WidgetsCells GWT AbstractInputCell

AbstractEventInputCell

FieldCell

ValueBaseFieldCell

CheckBoxCell TextInputCell TriggerFieldCell

ComboCell DateCell

SliderCell

TwinTriggerFieldCell

NumberCell

SpinnerFieldCell

ButtonCellProgressBarCell

SplitButtonCell

Page 24: GWT.create 2013: Introduction to GXT

• Cell support in all data widgets • Tree, ListView, Grid,TreeGrid • Replaces Widget support in data widgets from 2.0 • High performance, interactive behavior

Cells & Cell WidgetsCell Widgets

Page 25: GWT.create 2013: Introduction to GXT

Cells & Cell WidgetsCell Example

ColumnConfig column = new ColumnConfig();column.setRenderer(renderer);!cc1 = new ColumnConfig<Plant, String>(properties.name(), 100, "Name"); TextButtonCell button = new TextButtonCell();button.addSelectHandler(new SelectHandler() { @Override public void onSelect(SelectEvent event) { Context c = event.getContext(); int row = c.getIndex(); Plant p = store.get(row); Info.display("Event", "The " + p.getName() + " was clicked."); }});cc1.setCell(button);

Page 26: GWT.create 2013: Introduction to GXT

UIBinder

Page 27: GWT.create 2013: Introduction to GXT

• Declarative user interfaces via Xml • Separations of duties Java developers and designers • Supports both widgets and HTML markup • Supports CSS

UIBinderGWT Binder

<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' ...>! <container:CenterLayoutContainer> <gxt:ContentPanel bodyStyle="padding: 6px" headingText="CenterLayout" width="200"> <g:Label text="I should be centered" /> </gxt:ContentPanel> </container:CenterLayoutContainer>!</ui:UiBinder>

Page 28: GWT.create 2013: Introduction to GXT

Layouts

Page 29: GWT.create 2013: Introduction to GXT

Charts

Page 30: GWT.create 2013: Introduction to GXT

Appearance & Theming

Page 31: GWT.create 2013: Introduction to GXT

Continue the discussion Getting Started with GXT 3.1 in Room 3

Page 32: GWT.create 2013: Introduction to GXT

Sencha GXT 3.1 (What’s Coming - Q1 2014)

Page 33: GWT.create 2013: Introduction to GXT

Theme BuilderIntroduction of Styling Configs

Before

After panel {

font { color = "#ffffff" family = "Tahoma, Arial" size = "14px" weight = "bold" } borderStyle = "solid" borderColor = "#157FCC" }

Page 34: GWT.create 2013: Introduction to GXT

Sencha GXT 4.0 (In The Making - Summer End 2014)

Page 35: GWT.create 2013: Introduction to GXT

✔ Gestures & Events Normalization ✔ Global Event Delegation ✔ Momentum Scrolling

GXT 4.0 - Tablet SupportTouch Events

tap

swipe

pinch

touchmove

touchstart/end

longpress

rotate doubletap

tapcancel

singletap

pinchstart/end

rotatestart/end

drag

Page 36: GWT.create 2013: Introduction to GXT

GXT 4.0 - Charts Package Bringing Touch Gestures to GXT Charts

GXT ChartsDesigned for Desktop (Plenty of Memory & CPU) !Mouse Inputs

GXT Touch ChartsOptimized for Touch Devices !Touch Inputs

Page 37: GWT.create 2013: Introduction to GXT

GXT 4.0 - ARIA SupportAccessibility & 508 Compliance

Page 38: GWT.create 2013: Introduction to GXT

GXT 4.0 - RTL SupportLeft to Right (LTR)

Right to Left (RTL)

Page 39: GWT.create 2013: Introduction to GXT

Thank You! Questions?