SlideShare a Scribd company logo
1 of 38
Download to read offline
HOW TO IMPROVE
YOUR PRODUCTIVITY
USING GWTP
CHRISTIAN GOUDREAU
GWT.create 2015
Motivations
HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
➔ Scalability
➔ Maintainability
➔ Extensibility
Architecture
HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
➔ SOLID - Uncle Bob
➔ MVP - Martin Fowler
➔ Iterative and incremental
development - Craig
Larman
THERE’S JUST
TOO MANY
GOOD PRACTICES
Frontend
HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
➔ GWTP
➔ REST-Dispatch
➔ GSS
MODEL
PRESENTER
VIEW
MVP
PATTERN
Presenter
HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
public class ApplicationPresenter
extends Presenter<ApplicationPresenter.MyView, ApplicationPresenter.MyProxy> {
interface MyView extends View {
}
@ProxyStandard
interface MyProxy extends Proxy<ApplicationPresenter> {
}
@ContentSlot
public static final Type<RevealContentHandler<?>> SLOT_MAIN = new Type<RevealContentHandler<?>>();
@Inject
ApplicationPresenter(EventBus eventBus,
MyView view,
MyProxy proxy) {
super(eventBus, view, proxy, RevealType.RootLayout);
}
@Override
protected void onReveal() {
}
@Override
protected void onBind() {
}
}
View
HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
public class ApplicationView extends ViewImpl implements ApplicationPresenter.MyView {
interface Binder extends UiBinder<Widget, ApplicationView> {
}
@UiField
SimplePanel main;
@Inject
ApplicationView(Binder uiBinder) {
initWidget(uiBinder.createAndBindUi(this));
}
@Override
public void setInSlot(Object slot, IsWidget content) {
if (slot == ApplicationPresenter.SLOT_MAIN) {
main.setWidget(content);
}
}
}
Model
HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
public class Dashboard {
private int id;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}
GWTP
Lifecycle
Tips
HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
➔ Use UiHandlers
➔ Use the EventBus
➔ Use collaborators
UiHandlers and Presenter
HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
public interface FeedbackUiHandlers extends UiHandlers {
void performMail(Feedback currentFeedback);
}
public class FeedbackPresenter
extends Presenter<FeedbackPresenter.MyView, FeedbackPresenter.MyProxy>
implements FeedbackUiHandlers {
...
@Inject
FeedbackPresenter(...) {
super(...);
getView().setUiHandlers(this);
}
@Override
public void performMail(Feedback currentFeedback) {
...
}
}
View
HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
public class FeedbackView
extends ViewWithUiHandlers<FeedbackUiHandlers>
implements FeedbackPresenter.MyView {
...
@UiHandler("submit")
void onClick(ClickEvent e) {
getUiHandlers().performMail(feedback);
}
}
EventBus
HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
@Override
protected void onReveal() {
themeService.withCallback(new AbstractAsyncCallback<Theme>() {
@Override
public void onSuccess(Theme result) {
super.onSuccess(result);
getView().edit(result);
}
}).getByOrganizationId(currentUser.getOrganizationId());
UpdateBreadcrumbEvent.fire(this, breadcrumbBuilder.theme());
}
Collaborators
HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
public interface LocationFacade {
/**
* Adds a new browser history entry. Calling this method will cause
* {@link com.google.gwt.event.logical.shared.ValueChangeHandler
* #onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)}
* to be called as well if and only if issueEvent is true.
*
* @param historyToken the token to associate with the new history item
* @param issueEvent true if a
* {@link com.google.gwt.event.logical.shared.ValueChangeHandler
* #onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)}
* event should be issued
*/
void newItem(String historyToken, boolean issueEvent);
/**
* Reloads the current browser window. All GWT state will be lost.
*/
void reload();
String getCurrentHash();
}
public class LocationFacadeImpl implements LocationFacade {
@Override
public void newItem(String newUrl, boolean fireEvent) {
History.newItem(newUrl, fireEvent);
}
@Override
public native void reload() /*-{
$wnd.location.reload(true);
}-*/;
@Override
public String getCurrentHash() {
return Location.getHash();
}
}
REST
Dispatch
HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
➔ JAX-RS
➔ Command pattern
➔ Simplest implementation
REST
Dispatch
HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
➔ JAX-RS
➔ Command pattern
➔ Simplest implementation
Bonus
➔ Response - RestCallback
➔ GWTP-Extensions - Rest-
delegates
Downside - not type safe
REST Dispatch setup
HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
public class ServiceModule extends AbstractGinModule {
@Override
protected void configure() {
install(new RestDispatchAsyncModule.Builder().build());
}
@Provides
@RestApplicationPath
String getApplicationPath() {
String baseUrl = GWT.getHostPageBaseURL();
if (baseUrl.endsWith("/")) {
baseUrl = baseUrl.substring(0, baseUrl.length() - 1);
}
return baseUrl + API;
}
}
<inherits name="com.gwtplatform.dispatch.rest.delegates.ResourceDelegate"/>
<inherits name='com.gwtplatform.mvp.MvpWithEntryPoint'/>
REST Dispatch usage
HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
@Path(DASHBOARDS)
public interface DashboardService {
@GET
@Path(DASHBOARD)
Dashboard getByOrganizationId(@PathParam(ORGANIZATION_ID) int organizationId);
@PUT
@Path(DASHBOARD)
void update(@PathParam(ORGANIZATION_ID) int organizationId, Dashboard dashboard);
}
private void loadTemplate() {
dashboardService.withCallback(new AbstractAsyncCallback<Dashboard>() {
@Override
public void onSuccess(Dashboard result) {
setInSlot(SLOT_TEMPLATE, templateSelector.createTemplate(result));
}
}).getByOrganizationId(currentUser.getOrganizationId());
}
UIDesign
HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
➔ GSS + GSSS
➔ UiBinder
➔ CSS expert
GSS + GSSS
HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
@Source({"com/arcbees/gsss/mixin/client/mixins.gss", "css/colors.gss", "fonts/geometria/geometria.gss", "css/style.gss"})
Style style();
@Source({"com/arcbees/website/client/resources/css/gridSettings.gss", "com/arcbees/gsss/grid/client/grid.gss"})
GridResources.Grid grid();
http://dev.arcbees.com/gsss/mixins/
@require "colors";
@require "geometria";
@require "gsss-mixins";
* {
box-sizing: border-box;
}
html {
font-size: 62.5%;
}
@media (max-width: 979px) {
html {
font-size: 59%;
}
}
.selectedFile {
background-color: C_PRIMARY;
color: #fff;
display: inline-block;
padding: .5rem .5rem .5rem 1rem;
@mixin rounded(4px);
}
What’s next?
HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
➔ Full JAX-RS coverage
➔ XML and custom
serializers/deserializers
➔ New way of writing Presenters
➔ Generator rewrite for extensibility
➔ Pushstate
https://docs.google.com/a/arcbees.com/document/d/1N9dMDxTFmZzF3xNTpnP3HIuwZC9OGtPPm_QVEikMP4g/
@Presenter(token = HOME, for = MyView.class, slot = ApplicationPresenter.SLOT_MAIN)
@UseCodeSplit
@UseGatekeeper(AclGatekeeper.class)
@GatekeeperParams(ORGANIZATION_SETTINGS_DASHBOARD_READ)
public class DashboardPresenter {
interface MyView extends View {
}
@Inject
DashboardPresenter() {
}
@OnReveal
void onReveal() {
}
@OnBind
void onBind() {
}
...
}
THANK YOU
Christian Goudreau
Co-Founder and Bee-EO
at Arcbees
+ChristianGoudreau
@imchrisgoudreau
QUESTIONS ?

More Related Content

Recently uploaded

Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform EngineeringMarcus Vechiato
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptxFIDO Alliance
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxFIDO Alliance
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...ScyllaDB
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024Stephen Perrenod
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewDianaGray10
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!Memoori
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxFIDO Alliance
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxFIDO Alliance
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfFIDO Alliance
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentationyogeshlabana357357
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераMark Opanasiuk
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024Lorenzo Miniero
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxjbellis
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe中 央社
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfFIDO Alliance
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Hiroshi SHIBATA
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTopCSSGallery
 

Recently uploaded (20)

Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development Companies
 

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

How to improve your productivity using GWTP

  • 1. HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP CHRISTIAN GOUDREAU GWT.create 2015
  • 2. Motivations HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP ➔ Scalability ➔ Maintainability ➔ Extensibility
  • 3. Architecture HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP ➔ SOLID - Uncle Bob ➔ MVP - Martin Fowler ➔ Iterative and incremental development - Craig Larman
  • 5. Frontend HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP ➔ GWTP ➔ REST-Dispatch ➔ GSS
  • 7. Presenter HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
  • 8. public class ApplicationPresenter extends Presenter<ApplicationPresenter.MyView, ApplicationPresenter.MyProxy> { interface MyView extends View { } @ProxyStandard interface MyProxy extends Proxy<ApplicationPresenter> { } @ContentSlot public static final Type<RevealContentHandler<?>> SLOT_MAIN = new Type<RevealContentHandler<?>>(); @Inject ApplicationPresenter(EventBus eventBus, MyView view, MyProxy proxy) { super(eventBus, view, proxy, RevealType.RootLayout); } @Override protected void onReveal() { } @Override protected void onBind() { } }
  • 9. View HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
  • 10. public class ApplicationView extends ViewImpl implements ApplicationPresenter.MyView { interface Binder extends UiBinder<Widget, ApplicationView> { } @UiField SimplePanel main; @Inject ApplicationView(Binder uiBinder) { initWidget(uiBinder.createAndBindUi(this)); } @Override public void setInSlot(Object slot, IsWidget content) { if (slot == ApplicationPresenter.SLOT_MAIN) { main.setWidget(content); } } }
  • 11. Model HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
  • 12. public class Dashboard { private int id; public int getId() { return id; } public void setId(int id) { this.id = id; } }
  • 14. Tips HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP ➔ Use UiHandlers ➔ Use the EventBus ➔ Use collaborators
  • 15. UiHandlers and Presenter HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
  • 16. public interface FeedbackUiHandlers extends UiHandlers { void performMail(Feedback currentFeedback); } public class FeedbackPresenter extends Presenter<FeedbackPresenter.MyView, FeedbackPresenter.MyProxy> implements FeedbackUiHandlers { ... @Inject FeedbackPresenter(...) { super(...); getView().setUiHandlers(this); } @Override public void performMail(Feedback currentFeedback) { ... } }
  • 17. View HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
  • 18. public class FeedbackView extends ViewWithUiHandlers<FeedbackUiHandlers> implements FeedbackPresenter.MyView { ... @UiHandler("submit") void onClick(ClickEvent e) { getUiHandlers().performMail(feedback); } }
  • 19. EventBus HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
  • 20. @Override protected void onReveal() { themeService.withCallback(new AbstractAsyncCallback<Theme>() { @Override public void onSuccess(Theme result) { super.onSuccess(result); getView().edit(result); } }).getByOrganizationId(currentUser.getOrganizationId()); UpdateBreadcrumbEvent.fire(this, breadcrumbBuilder.theme()); }
  • 21. Collaborators HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
  • 22. public interface LocationFacade { /** * Adds a new browser history entry. Calling this method will cause * {@link com.google.gwt.event.logical.shared.ValueChangeHandler * #onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)} * to be called as well if and only if issueEvent is true. * * @param historyToken the token to associate with the new history item * @param issueEvent true if a * {@link com.google.gwt.event.logical.shared.ValueChangeHandler * #onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)} * event should be issued */ void newItem(String historyToken, boolean issueEvent); /** * Reloads the current browser window. All GWT state will be lost. */ void reload(); String getCurrentHash(); }
  • 23. public class LocationFacadeImpl implements LocationFacade { @Override public void newItem(String newUrl, boolean fireEvent) { History.newItem(newUrl, fireEvent); } @Override public native void reload() /*-{ $wnd.location.reload(true); }-*/; @Override public String getCurrentHash() { return Location.getHash(); } }
  • 24. REST Dispatch HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP ➔ JAX-RS ➔ Command pattern ➔ Simplest implementation
  • 25. REST Dispatch HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP ➔ JAX-RS ➔ Command pattern ➔ Simplest implementation Bonus ➔ Response - RestCallback ➔ GWTP-Extensions - Rest- delegates Downside - not type safe
  • 26. REST Dispatch setup HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
  • 27. public class ServiceModule extends AbstractGinModule { @Override protected void configure() { install(new RestDispatchAsyncModule.Builder().build()); } @Provides @RestApplicationPath String getApplicationPath() { String baseUrl = GWT.getHostPageBaseURL(); if (baseUrl.endsWith("/")) { baseUrl = baseUrl.substring(0, baseUrl.length() - 1); } return baseUrl + API; } } <inherits name="com.gwtplatform.dispatch.rest.delegates.ResourceDelegate"/> <inherits name='com.gwtplatform.mvp.MvpWithEntryPoint'/>
  • 28. REST Dispatch usage HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
  • 29. @Path(DASHBOARDS) public interface DashboardService { @GET @Path(DASHBOARD) Dashboard getByOrganizationId(@PathParam(ORGANIZATION_ID) int organizationId); @PUT @Path(DASHBOARD) void update(@PathParam(ORGANIZATION_ID) int organizationId, Dashboard dashboard); } private void loadTemplate() { dashboardService.withCallback(new AbstractAsyncCallback<Dashboard>() { @Override public void onSuccess(Dashboard result) { setInSlot(SLOT_TEMPLATE, templateSelector.createTemplate(result)); } }).getByOrganizationId(currentUser.getOrganizationId()); }
  • 30. UIDesign HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP ➔ GSS + GSSS ➔ UiBinder ➔ CSS expert
  • 31. GSS + GSSS HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP
  • 32. @Source({"com/arcbees/gsss/mixin/client/mixins.gss", "css/colors.gss", "fonts/geometria/geometria.gss", "css/style.gss"}) Style style(); @Source({"com/arcbees/website/client/resources/css/gridSettings.gss", "com/arcbees/gsss/grid/client/grid.gss"}) GridResources.Grid grid(); http://dev.arcbees.com/gsss/mixins/
  • 33. @require "colors"; @require "geometria"; @require "gsss-mixins"; * { box-sizing: border-box; } html { font-size: 62.5%; } @media (max-width: 979px) { html { font-size: 59%; } } .selectedFile { background-color: C_PRIMARY; color: #fff; display: inline-block; padding: .5rem .5rem .5rem 1rem; @mixin rounded(4px); }
  • 34. What’s next? HOW TO IMPROVE YOUR PRODUCTIVITY USING GWTP ➔ Full JAX-RS coverage ➔ XML and custom serializers/deserializers ➔ New way of writing Presenters ➔ Generator rewrite for extensibility ➔ Pushstate https://docs.google.com/a/arcbees.com/document/d/1N9dMDxTFmZzF3xNTpnP3HIuwZC9OGtPPm_QVEikMP4g/
  • 35. @Presenter(token = HOME, for = MyView.class, slot = ApplicationPresenter.SLOT_MAIN) @UseCodeSplit @UseGatekeeper(AclGatekeeper.class) @GatekeeperParams(ORGANIZATION_SETTINGS_DASHBOARD_READ) public class DashboardPresenter { interface MyView extends View { } @Inject DashboardPresenter() { } @OnReveal void onReveal() { } @OnBind void onBind() { } ... }
  • 37. Christian Goudreau Co-Founder and Bee-EO at Arcbees +ChristianGoudreau @imchrisgoudreau