SlideShare a Scribd company logo
Rapid Prototyping of
Eclipse RCP Applications
So, you want to create a quick RCP prototype for a client?
About us
• Speaker
• Patrik Suzzi, www.asegno.com
Eclipse Platform Committer,
Consultant Software Engineer
• Audience
• Are you familiar with JAXB, JPA,
Eclipse E4 and WindowBuilder?
IDE and Tools
• Eclipse IDE for RCP and RAP development (Oxygen RC3)
+ Nebula Widgets (to use XY Graph)
http://download.eclipse.org/nebula/releases/latest
+ WindowBuilder (if not already installed in Eclipse IDE for RCP..)
http://download.eclipse.org/windowbuilder/WB/integration/4.7/
• Libraries
+ EclipseLink (JPA and JAXB)
https://www.eclipse.org/eclipselink/downloads/
Steps to build a prototype (Banking)
• Data Model
• JAXB and JPA Annotations
• Test persistence
• E4 Application
• Simple UI
• Complex UI
• Working Example
Data Model
• Customer
• Account
• Transaction
Mock Data
Bank bank = new Bank();
//
bank.setName("Demo Bank");
// create customers
Customer c1 = new Customer("Tom", "Jones", "Garden Street 8", "tjones@test.com", "1998-04-06");
Customer c2 = new Customer("Diana", "Jones", "Garden Street 8", "djones@test.com", "1999-11-12");
Customer c3 = new Customer("Mark", "Reuters", "Maple Street 122", "mr@dot.com", "1958-03-18");
Customer c4 = new Customer("Spencer", "White", "Avenue Pontida 1", "swhite@site.com", "2000-01-05");
Customer c5 = new Customer("Alex", "Michaelson", "Red Square 14b", "alex@oxygen.com", "1982-05-06");
Customer c6 = new Customer("Francois", "Berger", "Frederickstrasse 87", "fberger@main.com", "1998-04-06");
bank.addCustomers(c1,c2,c3,c4,c5,c6);
// add accounts and link to customers
Account a1 = new Account().link(c1);
Account a2 = new Account().link(c1, c2);
Account a3 = new Account().link(c3);
Account a4 = new Account().link(c4);
Account a5 = new Account().link(c5);
Account a6 = new Account().link(c6);
Account a7 = new Account().link(c6);
bank.addAccounts(a1,a2,a3,a4,a5,a6,a7);
// add transactions
Transaction t1 = new Deposit().create(5000, a1).confirm("2016-02-20").process();
Transaction t2 = new Charge().create(250, a1).confirm("2016-03-10").process();
Transaction t3 = new Transfer().create(1000, a1, a2).confirm("2016-04-05").process();
Transaction t4 = new Deposit().create(10000, a3).confirm("2016-04-06").process();
Transaction t5 = new Deposit().create(5000, a3).confirm("2016-04-10").process();
Transaction t6 = new Deposit().create(5000, a3).confirm("2016-06-21").process();
Transaction t7 = new Deposit().create(10000, a3).confirm("2016-06-23").process();
Transaction t8 = new Withdrawal().create(2500, a3).confirm("2016-07-01").process();
Transaction t9 = new Charge().create(1500, a3).confirm("2016-07-03").process();
Transaction t10 = new Transfer().create(1000, a3, a2).confirm("2016-07-05").process();
bank.addTransactions(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10);
JAXB Annotations
@XmlSeeAlso
Super/subclasses
@XmlRootElement
@XmlElement
@XmlAttribute, @XmlID
ID as attribute
@XmlList, @XmlIDREF
List of references
XML Persistence
• Save and Load with JAXB
public static void persistXml(File xmlFile, Bank bank) {
JAXBContext jaxbContext = JAXBContext.newInstance(Bank.class);
Marshaller marshaller = jaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.marshal(bank, xmlFile);
}
public static Bank loadXml(File xmlFile) {
JAXBContext jaxbContext = JAXBContext.newInstance(Bank.class);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
Bank bank = (Bank) unmarshaller.unmarshal(xmlFile);
return bank;
}
Usage: TestPersistence.java
JPA 2 Annotations
@MappedSuperclass
Superclasses
@Entity, @Table
@OneToMany, @JoinColumn
One-way association with reference
@ID
@Inheritance, @DiscriminatorColumn
Single-table Inheritance, superclass
@DiscriminatorValue
Single-table Inheritance, subclass
DB Persistence
• Persist and Load with JPA
public static void persistDB(Bank bank){
EntityManager em = instance().getEntityManager();
em.getTransaction().begin();
em.merge(bank);
em.flush();
em.getTransaction().commit();
}
public static Bank loadDB() throws JAXBException {
EntityManager em = instance().getEntityManager();
em.getTransaction().begin();
TypedQuery<Bank> query = em.createQuery(SELECT_BANK, Bank.class);
Bank bank = query.getSingleResult();
return bank;
}
Usage: TestPersistence.java
E4 RCP Application
• E4 Model Editor
• Perspectives
• Views
• ...
• 3 perspectives
• Customers
• Accounts
• Transactions
demo/step1: E4 App
Customers perspective
• Search
• Select
• Edit user
Filter/search
select
edit
Window Builder, Simple UI
• Visual Designer
• Data Binding
• Custom code
public void setModel(Bank model) {
if(model==null) return;
disposeBindings(m_bindingContext);
super.setModel(model);
if(listViewer==null) return;
m_bindingContext = initDataBindings();
update();
}
@Inject
@Optional
private void modelModified(@UIEventTopic(EventConstants.TOPIC_MODEL_MODIFIED) Account account) {
update();
}
// User Interaction ..
demo/step2: simple UI
Window Builder, Complex UI
• Canvas
• Table Data Binding
• Custom code
private void update() {
tableViewer.refresh();
tableViewer_1.refresh();
resizeColumns(table);
resizeColumns(table_1);
LightweightSystem lws = new LightweightSystem(canvas);
ChartHelper.generateGraph(lws, getModel());
}
demo/step3: complex UI
Accounts perspective
• Search
• Balance chart
• Tables
Filter/search
Transactions perspective
• Search
• Edit
• Create new
• Process transaction
(...)
Working application
• Customers
• Persistence
demo/step4: working application
Concluding
• Rapid prototype, fully customizable, persist your data
• Source: https://github.com/psuzzi/eclipsecon.git
• Project: ecf2017/com.asegno.e4.banking
• Branch demo/step1, model and persistence tests
• Branch demo/step2, E4 App with Customers perspective
• Branch demo/step3, E4 App with Accounts perspective
• Branch demo/step4, Final prototype
• Please, get in touch if you need more information.
psuzzi[at]gmail[dot]com
www.asegno.com
-1 0
Sign in and vote at
eclipsecon.org

More Related Content

PDF
Delightful steps to becoming a functioning user of Step Functions
PDF
KliqMap 1.0 english v4
PPTX
Apple.combine
PDF
Streaming sql w kafka and flink
PDF
Haystack Live tallison_202010_v2
PPTX
U-SQL User-Defined Operators (UDOs) (SQLBits 2016)
PDF
Streams or Loops? Java 8 Stream API by Niki Petkov - Proxiad Bulgaria
PDF
Writing an Interactive Interface for SQL on Flink
Delightful steps to becoming a functioning user of Step Functions
KliqMap 1.0 english v4
Apple.combine
Streaming sql w kafka and flink
Haystack Live tallison_202010_v2
U-SQL User-Defined Operators (UDOs) (SQLBits 2016)
Streams or Loops? Java 8 Stream API by Niki Petkov - Proxiad Bulgaria
Writing an Interactive Interface for SQL on Flink

Similar to Rapid prototyping of eclipse rcp applications 2017 (20)

PPTX
Rapid prototyping of eclipse rcp applications - Eclipsecon Europe 2017
PPT
RESTful Data Access Services with Java EE
PPT
RESTful services with JAXB and JPA
PPTX
WebLogic Developer Webcast 1: JPA 2.0
PPT
Practical RESTful Persistence
PDF
Enterprise Persistence in OSGi - Mike Keith, Oracle
ODP
Interoperable Web Services with JAX-WS
PDF
Java persistence api 2.1
PDF
Using the latest Java Persistence API 2 Features - Tech Days 2010 India
PDF
ODP
JavaEE Spring Seam
PPT
OSGi Persistence With EclipseLink
PDF
Java Persistence 2.0
ODP
Java Persistence API
KEY
Enterprise Java Web Application Frameworks Sample Stack Implementation
PPTX
The Evolution of Java Persistence
PPT
PPTX
Introduction to JPA (JPA version 2.0)
PPT
JEST: REST on OpenJPA
DOCX
Ecom lec4 fall16_jpa
Rapid prototyping of eclipse rcp applications - Eclipsecon Europe 2017
RESTful Data Access Services with Java EE
RESTful services with JAXB and JPA
WebLogic Developer Webcast 1: JPA 2.0
Practical RESTful Persistence
Enterprise Persistence in OSGi - Mike Keith, Oracle
Interoperable Web Services with JAX-WS
Java persistence api 2.1
Using the latest Java Persistence API 2 Features - Tech Days 2010 India
JavaEE Spring Seam
OSGi Persistence With EclipseLink
Java Persistence 2.0
Java Persistence API
Enterprise Java Web Application Frameworks Sample Stack Implementation
The Evolution of Java Persistence
Introduction to JPA (JPA version 2.0)
JEST: REST on OpenJPA
Ecom lec4 fall16_jpa
Ad

Recently uploaded (20)

PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
cuic standard and advanced reporting.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Electronic commerce courselecture one. Pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Big Data Technologies - Introduction.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
KodekX | Application Modernization Development
PPTX
Spectroscopy.pptx food analysis technology
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPT
Teaching material agriculture food technology
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Diabetes mellitus diagnosis method based random forest with bat algorithm
cuic standard and advanced reporting.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Per capita expenditure prediction using model stacking based on satellite ima...
Digital-Transformation-Roadmap-for-Companies.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Electronic commerce courselecture one. Pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
sap open course for s4hana steps from ECC to s4
Programs and apps: productivity, graphics, security and other tools
Big Data Technologies - Introduction.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Machine learning based COVID-19 study performance prediction
KodekX | Application Modernization Development
Spectroscopy.pptx food analysis technology
Advanced methodologies resolving dimensionality complications for autism neur...
Teaching material agriculture food technology
Ad

Rapid prototyping of eclipse rcp applications 2017

  • 1. Rapid Prototyping of Eclipse RCP Applications So, you want to create a quick RCP prototype for a client?
  • 2. About us • Speaker • Patrik Suzzi, www.asegno.com Eclipse Platform Committer, Consultant Software Engineer • Audience • Are you familiar with JAXB, JPA, Eclipse E4 and WindowBuilder?
  • 3. IDE and Tools • Eclipse IDE for RCP and RAP development (Oxygen RC3) + Nebula Widgets (to use XY Graph) http://download.eclipse.org/nebula/releases/latest + WindowBuilder (if not already installed in Eclipse IDE for RCP..) http://download.eclipse.org/windowbuilder/WB/integration/4.7/ • Libraries + EclipseLink (JPA and JAXB) https://www.eclipse.org/eclipselink/downloads/
  • 4. Steps to build a prototype (Banking) • Data Model • JAXB and JPA Annotations • Test persistence • E4 Application • Simple UI • Complex UI • Working Example
  • 5. Data Model • Customer • Account • Transaction
  • 6. Mock Data Bank bank = new Bank(); // bank.setName("Demo Bank"); // create customers Customer c1 = new Customer("Tom", "Jones", "Garden Street 8", "tjones@test.com", "1998-04-06"); Customer c2 = new Customer("Diana", "Jones", "Garden Street 8", "djones@test.com", "1999-11-12"); Customer c3 = new Customer("Mark", "Reuters", "Maple Street 122", "mr@dot.com", "1958-03-18"); Customer c4 = new Customer("Spencer", "White", "Avenue Pontida 1", "swhite@site.com", "2000-01-05"); Customer c5 = new Customer("Alex", "Michaelson", "Red Square 14b", "alex@oxygen.com", "1982-05-06"); Customer c6 = new Customer("Francois", "Berger", "Frederickstrasse 87", "fberger@main.com", "1998-04-06"); bank.addCustomers(c1,c2,c3,c4,c5,c6); // add accounts and link to customers Account a1 = new Account().link(c1); Account a2 = new Account().link(c1, c2); Account a3 = new Account().link(c3); Account a4 = new Account().link(c4); Account a5 = new Account().link(c5); Account a6 = new Account().link(c6); Account a7 = new Account().link(c6); bank.addAccounts(a1,a2,a3,a4,a5,a6,a7); // add transactions Transaction t1 = new Deposit().create(5000, a1).confirm("2016-02-20").process(); Transaction t2 = new Charge().create(250, a1).confirm("2016-03-10").process(); Transaction t3 = new Transfer().create(1000, a1, a2).confirm("2016-04-05").process(); Transaction t4 = new Deposit().create(10000, a3).confirm("2016-04-06").process(); Transaction t5 = new Deposit().create(5000, a3).confirm("2016-04-10").process(); Transaction t6 = new Deposit().create(5000, a3).confirm("2016-06-21").process(); Transaction t7 = new Deposit().create(10000, a3).confirm("2016-06-23").process(); Transaction t8 = new Withdrawal().create(2500, a3).confirm("2016-07-01").process(); Transaction t9 = new Charge().create(1500, a3).confirm("2016-07-03").process(); Transaction t10 = new Transfer().create(1000, a3, a2).confirm("2016-07-05").process(); bank.addTransactions(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10);
  • 8. XML Persistence • Save and Load with JAXB public static void persistXml(File xmlFile, Bank bank) { JAXBContext jaxbContext = JAXBContext.newInstance(Bank.class); Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(bank, xmlFile); } public static Bank loadXml(File xmlFile) { JAXBContext jaxbContext = JAXBContext.newInstance(Bank.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); Bank bank = (Bank) unmarshaller.unmarshal(xmlFile); return bank; } Usage: TestPersistence.java
  • 9. JPA 2 Annotations @MappedSuperclass Superclasses @Entity, @Table @OneToMany, @JoinColumn One-way association with reference @ID @Inheritance, @DiscriminatorColumn Single-table Inheritance, superclass @DiscriminatorValue Single-table Inheritance, subclass
  • 10. DB Persistence • Persist and Load with JPA public static void persistDB(Bank bank){ EntityManager em = instance().getEntityManager(); em.getTransaction().begin(); em.merge(bank); em.flush(); em.getTransaction().commit(); } public static Bank loadDB() throws JAXBException { EntityManager em = instance().getEntityManager(); em.getTransaction().begin(); TypedQuery<Bank> query = em.createQuery(SELECT_BANK, Bank.class); Bank bank = query.getSingleResult(); return bank; } Usage: TestPersistence.java
  • 11. E4 RCP Application • E4 Model Editor • Perspectives • Views • ... • 3 perspectives • Customers • Accounts • Transactions demo/step1: E4 App
  • 12. Customers perspective • Search • Select • Edit user Filter/search select edit
  • 13. Window Builder, Simple UI • Visual Designer • Data Binding • Custom code public void setModel(Bank model) { if(model==null) return; disposeBindings(m_bindingContext); super.setModel(model); if(listViewer==null) return; m_bindingContext = initDataBindings(); update(); } @Inject @Optional private void modelModified(@UIEventTopic(EventConstants.TOPIC_MODEL_MODIFIED) Account account) { update(); } // User Interaction .. demo/step2: simple UI
  • 14. Window Builder, Complex UI • Canvas • Table Data Binding • Custom code private void update() { tableViewer.refresh(); tableViewer_1.refresh(); resizeColumns(table); resizeColumns(table_1); LightweightSystem lws = new LightweightSystem(canvas); ChartHelper.generateGraph(lws, getModel()); } demo/step3: complex UI
  • 15. Accounts perspective • Search • Balance chart • Tables Filter/search
  • 16. Transactions perspective • Search • Edit • Create new • Process transaction (...)
  • 17. Working application • Customers • Persistence demo/step4: working application
  • 18. Concluding • Rapid prototype, fully customizable, persist your data • Source: https://github.com/psuzzi/eclipsecon.git • Project: ecf2017/com.asegno.e4.banking • Branch demo/step1, model and persistence tests • Branch demo/step2, E4 App with Customers perspective • Branch demo/step3, E4 App with Accounts perspective • Branch demo/step4, Final prototype • Please, get in touch if you need more information. psuzzi[at]gmail[dot]com www.asegno.com
  • 19. -1 0 Sign in and vote at eclipsecon.org