SlideShare una empresa de Scribd logo
1 de 19
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

Más contenido relacionado

Similar a Rapid prototyping of eclipse rcp applications 2017

Developing streaming applications with apache apex (strata + hadoop world)
Developing streaming applications with apache apex (strata + hadoop world)Developing streaming applications with apache apex (strata + hadoop world)
Developing streaming applications with apache apex (strata + hadoop world)
Apache Apex
 

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

Rapid prototyping of eclipse rcp applications - Eclipsecon Europe 2017
Rapid prototyping of eclipse rcp applications - Eclipsecon Europe 2017Rapid prototyping of eclipse rcp applications - Eclipsecon Europe 2017
Rapid prototyping of eclipse rcp applications - Eclipsecon Europe 2017
 
Dax Declarative Api For Xml
Dax   Declarative Api For XmlDax   Declarative Api For Xml
Dax Declarative Api For Xml
 
Apache Samza 1.0 - What's New, What's Next
Apache Samza 1.0 - What's New, What's NextApache Samza 1.0 - What's New, What's Next
Apache Samza 1.0 - What's New, What's Next
 
Developing streaming applications with apache apex (strata + hadoop world)
Developing streaming applications with apache apex (strata + hadoop world)Developing streaming applications with apache apex (strata + hadoop world)
Developing streaming applications with apache apex (strata + hadoop world)
 
Apache Spark Streaming: Architecture and Fault Tolerance
Apache Spark Streaming: Architecture and Fault ToleranceApache Spark Streaming: Architecture and Fault Tolerance
Apache Spark Streaming: Architecture and Fault Tolerance
 
Google cloud Dataflow & Apache Flink
Google cloud Dataflow & Apache FlinkGoogle cloud Dataflow & Apache Flink
Google cloud Dataflow & Apache Flink
 
Couchbase@live person meetup july 22nd
Couchbase@live person meetup   july 22ndCouchbase@live person meetup   july 22nd
Couchbase@live person meetup july 22nd
 
TypeScript and SharePoint Framework
TypeScript and SharePoint FrameworkTypeScript and SharePoint Framework
TypeScript and SharePoint Framework
 
XStream: stream processing platform at facebook
XStream:  stream processing platform at facebookXStream:  stream processing platform at facebook
XStream: stream processing platform at facebook
 
Ajax
AjaxAjax
Ajax
 
How bol.com makes sense of its logs, using the Elastic technology stack.
How bol.com makes sense of its logs, using the Elastic technology stack.How bol.com makes sense of its logs, using the Elastic technology stack.
How bol.com makes sense of its logs, using the Elastic technology stack.
 
Distributed Real-Time Stream Processing: Why and How 2.0
Distributed Real-Time Stream Processing:  Why and How 2.0Distributed Real-Time Stream Processing:  Why and How 2.0
Distributed Real-Time Stream Processing: Why and How 2.0
 
Deep learning and streaming in Apache Spark 2.2 by Matei Zaharia
Deep learning and streaming in Apache Spark 2.2 by Matei ZahariaDeep learning and streaming in Apache Spark 2.2 by Matei Zaharia
Deep learning and streaming in Apache Spark 2.2 by Matei Zaharia
 
Awesome Banking API's
Awesome Banking API'sAwesome Banking API's
Awesome Banking API's
 
Building a Sustainable Data Platform on AWS
Building a Sustainable Data Platform on AWSBuilding a Sustainable Data Platform on AWS
Building a Sustainable Data Platform on AWS
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
 
Event Driven Microservices
Event Driven MicroservicesEvent Driven Microservices
Event Driven Microservices
 
KSQL - Stream Processing simplified!
KSQL - Stream Processing simplified!KSQL - Stream Processing simplified!
KSQL - Stream Processing simplified!
 
Jackson beyond JSON: XML, CSV
Jackson beyond JSON: XML, CSVJackson beyond JSON: XML, CSV
Jackson beyond JSON: XML, CSV
 
Distributed Real-Time Stream Processing: Why and How: Spark Summit East talk ...
Distributed Real-Time Stream Processing: Why and How: Spark Summit East talk ...Distributed Real-Time Stream Processing: Why and How: Spark Summit East talk ...
Distributed Real-Time Stream Processing: Why and How: Spark Summit East talk ...
 

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

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