SlideShare a Scribd company logo
Adapting to Tablets & Desktops - Part I
© Codename One 2017 all rights reserved
Before
© Codename One 2017 all rights reserved
After
After
Architecture
✦In the current app every UI element derives from
form and stands alone, in the tablet app we want
to have one form for the entire app
✦Instead of deriving from Form we derive from a
common base class
✦Every feature we need in Form is abstracted so
we can keep common code together
© Codename One 2017 all rights reserved
public class BaseNavigationForm extends UIAbstraction {
private static DishListForm dishForm;
private static BillingForm billingForm;
private static DetailsForm detailsForm;
private static AppForm appForm;
private static AboutForm aboutForm;
private final AppSettings app;
public BaseNavigationForm(AppSettings app, Layout l) {
super();
this.app = app;
initUI(Restaurant.getInstance().name.get(), l);
}
public static void showAppForm(AppSettings app) {
if(appForm == null) {
appForm = new AppForm(app);
}
appForm.show();
}
BaseNavigationForm
public class UIAbstraction {
private Button okButton;
class FormDelegate extends Form {
public FormDelegate(String title, Layout l) {
super(title, l);
initToolbar(getToolbar());
if(hasOKBack()) {
Form previousForm = Display.getInstance().getCurrent();
getToolbar().addMaterialCommandToLeftBar(“",
FontImage.MATERIAL_ARROW_BACK, e -> {
onBack();
previousForm.showBack();
});
Command cmd = getToolbar().addMaterialCommandToRightBar("",
FontImage.MATERIAL_CHECK, e -> {
onOK();
previousForm.showBack();
});
okButton = getToolbar().findCommandComponent(cmd);
}
}
UIAbstraction
public class UIAbstraction {
private Button okButton;
class FormDelegate extends Form {
public FormDelegate(String title, Layout l) {
super(title, l);
initToolbar(getToolbar());
if(hasOKBack()) {
Form previousForm = Display.getInstance().getCurrent();
getToolbar().addMaterialCommandToLeftBar(“",
FontImage.MATERIAL_ARROW_BACK, e -> {
onBack();
previousForm.showBack();
});
Command cmd = getToolbar().addMaterialCommandToRightBar("",
FontImage.MATERIAL_CHECK, e -> {
onOK();
previousForm.showBack();
});
okButton = getToolbar().findCommandComponent(cmd);
}
}
UIAbstraction
public class UIAbstraction {
private Button okButton;
class FormDelegate extends Form {
public FormDelegate(String title, Layout l) {
super(title, l);
initToolbar(getToolbar());
if(hasOKBack()) {
Form previousForm = Display.getInstance().getCurrent();
getToolbar().addMaterialCommandToLeftBar(“",
FontImage.MATERIAL_ARROW_BACK, e -> {
onBack();
previousForm.showBack();
});
Command cmd = getToolbar().addMaterialCommandToRightBar("",
FontImage.MATERIAL_CHECK, e -> {
onOK();
previousForm.showBack();
});
okButton = getToolbar().findCommandComponent(cmd);
}
}
UIAbstraction
public class UIAbstraction {
private Button okButton;
class FormDelegate extends Form {
public FormDelegate(String title, Layout l) {
super(title, l);
initToolbar(getToolbar());
if(hasOKBack()) {
Form previousForm = Display.getInstance().getCurrent();
getToolbar().addMaterialCommandToLeftBar(“",
FontImage.MATERIAL_ARROW_BACK, e -> {
onBack();
previousForm.showBack();
});
Command cmd = getToolbar().addMaterialCommandToRightBar("",
FontImage.MATERIAL_CHECK, e -> {
onOK();
previousForm.showBack();
});
okButton = getToolbar().findCommandComponent(cmd);
}
}
UIAbstraction
public class UIAbstraction {
private Button okButton;
class FormDelegate extends Form {
public FormDelegate(String title, Layout l) {
super(title, l);
initToolbar(getToolbar());
if(hasOKBack()) {
Form previousForm = Display.getInstance().getCurrent();
getToolbar().addMaterialCommandToLeftBar(“",
FontImage.MATERIAL_ARROW_BACK, e -> {
onBack();
previousForm.showBack();
});
Command cmd = getToolbar().addMaterialCommandToRightBar("",
FontImage.MATERIAL_CHECK, e -> {
onOK();
previousForm.showBack();
});
okButton = getToolbar().findCommandComponent(cmd);
}
}
UIAbstraction
protected Component createStatusBar() {
Component c = super.createStatusBar();
c.setUIID("Container");
return c;
}
@Override
protected void initGlobalToolbar() {
if(Toolbar.isGlobalToolbar()) {
setToolbar(new Toolbar(isLayeredToolbar()) {
@Override
protected void initTitleBarStatus() {
}
});
}
}
@Override
protected boolean shouldPaintStatusBar() {
return UIAbstraction.this.shouldPaintStatusBar();
}
}
UIAbstraction

More Related Content

Similar to Adapting to Tablets and Desktops - Part 1.pdf

Action bar
Action barAction bar
Action bar
Mu Chun Wang
 
Creating an Uber Clone - Part IX.pdf
Creating an Uber Clone - Part IX.pdfCreating an Uber Clone - Part IX.pdf
Creating an Uber Clone - Part IX.pdf
ShaiAlmog1
 
Adapting to Tablets and Desktops - Part 3.pdf
Adapting to Tablets and Desktops - Part 3.pdfAdapting to Tablets and Desktops - Part 3.pdf
Adapting to Tablets and Desktops - Part 3.pdf
ShaiAlmog1
 
4.Spring IoC&DI(Spring Ioc실습_어노테이션 기반)
4.Spring IoC&DI(Spring Ioc실습_어노테이션 기반)4.Spring IoC&DI(Spring Ioc실습_어노테이션 기반)
4.Spring IoC&DI(Spring Ioc실습_어노테이션 기반)
탑크리에듀(구로디지털단지역3번출구 2분거리)
 
Adapting to Tablets and Desktops - Part 3 - Transcript.pdf
Adapting to Tablets and Desktops - Part 3 - Transcript.pdfAdapting to Tablets and Desktops - Part 3 - Transcript.pdf
Adapting to Tablets and Desktops - Part 3 - Transcript.pdf
ShaiAlmog1
 
Dagger 2 vs koin
Dagger 2 vs koinDagger 2 vs koin
Dagger 2 vs koin
Jintin Lin
 
To-Do App With Flutter: Step By Step Guide
To-Do App With Flutter: Step By Step GuideTo-Do App With Flutter: Step By Step Guide
To-Do App With Flutter: Step By Step Guide
Biztech Consulting & Solutions
 
Creating an Uber Clone - Part XIX - Transcript.pdf
Creating an Uber Clone - Part XIX - Transcript.pdfCreating an Uber Clone - Part XIX - Transcript.pdf
Creating an Uber Clone - Part XIX - Transcript.pdf
ShaiAlmog1
 
Initial UI Mockup - Part 2 - Transcript.pdf
Initial UI Mockup - Part 2 - Transcript.pdfInitial UI Mockup - Part 2 - Transcript.pdf
Initial UI Mockup - Part 2 - Transcript.pdf
ShaiAlmog1
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app development
anistar sung
 
Sharper Better Faster Dagger ‡ - Droidcon SF
Sharper Better Faster Dagger ‡ - Droidcon SFSharper Better Faster Dagger ‡ - Droidcon SF
Sharper Better Faster Dagger ‡ - Droidcon SF
Pierre-Yves Ricau
 
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo
Ali Parmaksiz
 
21 android2 updated
21 android2 updated21 android2 updated
21 android2 updated
GhanaGTUG
 
Day 5
Day 5Day 5
How to code to code less
How to code to code lessHow to code to code less
How to code to code less
Anton Novikau
 
Net conf BG xamarin lecture
Net conf BG xamarin lectureNet conf BG xamarin lecture
Net conf BG xamarin lecture
Tsvyatko Konov
 
Creating an Uber Clone - Part XXXIV.pdf
Creating an Uber Clone - Part XXXIV.pdfCreating an Uber Clone - Part XXXIV.pdf
Creating an Uber Clone - Part XXXIV.pdf
ShaiAlmog1
 
Building a Native Camera Access Library - Part II.pdf
Building a Native Camera Access Library - Part II.pdfBuilding a Native Camera Access Library - Part II.pdf
Building a Native Camera Access Library - Part II.pdf
ShaiAlmog1
 
Sylius and Api Platform The story of integration
Sylius and Api Platform The story of integrationSylius and Api Platform The story of integration
Sylius and Api Platform The story of integration
Łukasz Chruściel
 
22Flutter.pdf
22Flutter.pdf22Flutter.pdf
22Flutter.pdf
dbaman
 

Similar to Adapting to Tablets and Desktops - Part 1.pdf (20)

Action bar
Action barAction bar
Action bar
 
Creating an Uber Clone - Part IX.pdf
Creating an Uber Clone - Part IX.pdfCreating an Uber Clone - Part IX.pdf
Creating an Uber Clone - Part IX.pdf
 
Adapting to Tablets and Desktops - Part 3.pdf
Adapting to Tablets and Desktops - Part 3.pdfAdapting to Tablets and Desktops - Part 3.pdf
Adapting to Tablets and Desktops - Part 3.pdf
 
4.Spring IoC&DI(Spring Ioc실습_어노테이션 기반)
4.Spring IoC&DI(Spring Ioc실습_어노테이션 기반)4.Spring IoC&DI(Spring Ioc실습_어노테이션 기반)
4.Spring IoC&DI(Spring Ioc실습_어노테이션 기반)
 
Adapting to Tablets and Desktops - Part 3 - Transcript.pdf
Adapting to Tablets and Desktops - Part 3 - Transcript.pdfAdapting to Tablets and Desktops - Part 3 - Transcript.pdf
Adapting to Tablets and Desktops - Part 3 - Transcript.pdf
 
Dagger 2 vs koin
Dagger 2 vs koinDagger 2 vs koin
Dagger 2 vs koin
 
To-Do App With Flutter: Step By Step Guide
To-Do App With Flutter: Step By Step GuideTo-Do App With Flutter: Step By Step Guide
To-Do App With Flutter: Step By Step Guide
 
Creating an Uber Clone - Part XIX - Transcript.pdf
Creating an Uber Clone - Part XIX - Transcript.pdfCreating an Uber Clone - Part XIX - Transcript.pdf
Creating an Uber Clone - Part XIX - Transcript.pdf
 
Initial UI Mockup - Part 2 - Transcript.pdf
Initial UI Mockup - Part 2 - Transcript.pdfInitial UI Mockup - Part 2 - Transcript.pdf
Initial UI Mockup - Part 2 - Transcript.pdf
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app development
 
Sharper Better Faster Dagger ‡ - Droidcon SF
Sharper Better Faster Dagger ‡ - Droidcon SFSharper Better Faster Dagger ‡ - Droidcon SF
Sharper Better Faster Dagger ‡ - Droidcon SF
 
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo
 
21 android2 updated
21 android2 updated21 android2 updated
21 android2 updated
 
Day 5
Day 5Day 5
Day 5
 
How to code to code less
How to code to code lessHow to code to code less
How to code to code less
 
Net conf BG xamarin lecture
Net conf BG xamarin lectureNet conf BG xamarin lecture
Net conf BG xamarin lecture
 
Creating an Uber Clone - Part XXXIV.pdf
Creating an Uber Clone - Part XXXIV.pdfCreating an Uber Clone - Part XXXIV.pdf
Creating an Uber Clone - Part XXXIV.pdf
 
Building a Native Camera Access Library - Part II.pdf
Building a Native Camera Access Library - Part II.pdfBuilding a Native Camera Access Library - Part II.pdf
Building a Native Camera Access Library - Part II.pdf
 
Sylius and Api Platform The story of integration
Sylius and Api Platform The story of integrationSylius and Api Platform The story of integration
Sylius and Api Platform The story of integration
 
22Flutter.pdf
22Flutter.pdf22Flutter.pdf
22Flutter.pdf
 

More from ShaiAlmog1

The Duck Teaches Learn to debug from the masters. Local to production- kill ...
The Duck Teaches  Learn to debug from the masters. Local to production- kill ...The Duck Teaches  Learn to debug from the masters. Local to production- kill ...
The Duck Teaches Learn to debug from the masters. Local to production- kill ...
ShaiAlmog1
 
create-netflix-clone-06-client-ui.pdf
create-netflix-clone-06-client-ui.pdfcreate-netflix-clone-06-client-ui.pdf
create-netflix-clone-06-client-ui.pdf
ShaiAlmog1
 
create-netflix-clone-01-introduction_transcript.pdf
create-netflix-clone-01-introduction_transcript.pdfcreate-netflix-clone-01-introduction_transcript.pdf
create-netflix-clone-01-introduction_transcript.pdf
ShaiAlmog1
 
create-netflix-clone-02-server_transcript.pdf
create-netflix-clone-02-server_transcript.pdfcreate-netflix-clone-02-server_transcript.pdf
create-netflix-clone-02-server_transcript.pdf
ShaiAlmog1
 
create-netflix-clone-04-server-continued_transcript.pdf
create-netflix-clone-04-server-continued_transcript.pdfcreate-netflix-clone-04-server-continued_transcript.pdf
create-netflix-clone-04-server-continued_transcript.pdf
ShaiAlmog1
 
create-netflix-clone-01-introduction.pdf
create-netflix-clone-01-introduction.pdfcreate-netflix-clone-01-introduction.pdf
create-netflix-clone-01-introduction.pdf
ShaiAlmog1
 
create-netflix-clone-06-client-ui_transcript.pdf
create-netflix-clone-06-client-ui_transcript.pdfcreate-netflix-clone-06-client-ui_transcript.pdf
create-netflix-clone-06-client-ui_transcript.pdf
ShaiAlmog1
 
create-netflix-clone-03-server.pdf
create-netflix-clone-03-server.pdfcreate-netflix-clone-03-server.pdf
create-netflix-clone-03-server.pdf
ShaiAlmog1
 
create-netflix-clone-04-server-continued.pdf
create-netflix-clone-04-server-continued.pdfcreate-netflix-clone-04-server-continued.pdf
create-netflix-clone-04-server-continued.pdf
ShaiAlmog1
 
create-netflix-clone-05-client-model_transcript.pdf
create-netflix-clone-05-client-model_transcript.pdfcreate-netflix-clone-05-client-model_transcript.pdf
create-netflix-clone-05-client-model_transcript.pdf
ShaiAlmog1
 
create-netflix-clone-03-server_transcript.pdf
create-netflix-clone-03-server_transcript.pdfcreate-netflix-clone-03-server_transcript.pdf
create-netflix-clone-03-server_transcript.pdf
ShaiAlmog1
 
create-netflix-clone-02-server.pdf
create-netflix-clone-02-server.pdfcreate-netflix-clone-02-server.pdf
create-netflix-clone-02-server.pdf
ShaiAlmog1
 
create-netflix-clone-05-client-model.pdf
create-netflix-clone-05-client-model.pdfcreate-netflix-clone-05-client-model.pdf
create-netflix-clone-05-client-model.pdf
ShaiAlmog1
 
Creating a Whatsapp Clone - Part II.pdf
Creating a Whatsapp Clone - Part II.pdfCreating a Whatsapp Clone - Part II.pdf
Creating a Whatsapp Clone - Part II.pdf
ShaiAlmog1
 
Creating a Whatsapp Clone - Part IX - Transcript.pdf
Creating a Whatsapp Clone - Part IX - Transcript.pdfCreating a Whatsapp Clone - Part IX - Transcript.pdf
Creating a Whatsapp Clone - Part IX - Transcript.pdf
ShaiAlmog1
 
Creating a Whatsapp Clone - Part II - Transcript.pdf
Creating a Whatsapp Clone - Part II - Transcript.pdfCreating a Whatsapp Clone - Part II - Transcript.pdf
Creating a Whatsapp Clone - Part II - Transcript.pdf
ShaiAlmog1
 
Creating a Whatsapp Clone - Part V - Transcript.pdf
Creating a Whatsapp Clone - Part V - Transcript.pdfCreating a Whatsapp Clone - Part V - Transcript.pdf
Creating a Whatsapp Clone - Part V - Transcript.pdf
ShaiAlmog1
 
Creating a Whatsapp Clone - Part IV - Transcript.pdf
Creating a Whatsapp Clone - Part IV - Transcript.pdfCreating a Whatsapp Clone - Part IV - Transcript.pdf
Creating a Whatsapp Clone - Part IV - Transcript.pdf
ShaiAlmog1
 
Creating a Whatsapp Clone - Part IV.pdf
Creating a Whatsapp Clone - Part IV.pdfCreating a Whatsapp Clone - Part IV.pdf
Creating a Whatsapp Clone - Part IV.pdf
ShaiAlmog1
 
Creating a Whatsapp Clone - Part I - Transcript.pdf
Creating a Whatsapp Clone - Part I - Transcript.pdfCreating a Whatsapp Clone - Part I - Transcript.pdf
Creating a Whatsapp Clone - Part I - Transcript.pdf
ShaiAlmog1
 

More from ShaiAlmog1 (20)

The Duck Teaches Learn to debug from the masters. Local to production- kill ...
The Duck Teaches  Learn to debug from the masters. Local to production- kill ...The Duck Teaches  Learn to debug from the masters. Local to production- kill ...
The Duck Teaches Learn to debug from the masters. Local to production- kill ...
 
create-netflix-clone-06-client-ui.pdf
create-netflix-clone-06-client-ui.pdfcreate-netflix-clone-06-client-ui.pdf
create-netflix-clone-06-client-ui.pdf
 
create-netflix-clone-01-introduction_transcript.pdf
create-netflix-clone-01-introduction_transcript.pdfcreate-netflix-clone-01-introduction_transcript.pdf
create-netflix-clone-01-introduction_transcript.pdf
 
create-netflix-clone-02-server_transcript.pdf
create-netflix-clone-02-server_transcript.pdfcreate-netflix-clone-02-server_transcript.pdf
create-netflix-clone-02-server_transcript.pdf
 
create-netflix-clone-04-server-continued_transcript.pdf
create-netflix-clone-04-server-continued_transcript.pdfcreate-netflix-clone-04-server-continued_transcript.pdf
create-netflix-clone-04-server-continued_transcript.pdf
 
create-netflix-clone-01-introduction.pdf
create-netflix-clone-01-introduction.pdfcreate-netflix-clone-01-introduction.pdf
create-netflix-clone-01-introduction.pdf
 
create-netflix-clone-06-client-ui_transcript.pdf
create-netflix-clone-06-client-ui_transcript.pdfcreate-netflix-clone-06-client-ui_transcript.pdf
create-netflix-clone-06-client-ui_transcript.pdf
 
create-netflix-clone-03-server.pdf
create-netflix-clone-03-server.pdfcreate-netflix-clone-03-server.pdf
create-netflix-clone-03-server.pdf
 
create-netflix-clone-04-server-continued.pdf
create-netflix-clone-04-server-continued.pdfcreate-netflix-clone-04-server-continued.pdf
create-netflix-clone-04-server-continued.pdf
 
create-netflix-clone-05-client-model_transcript.pdf
create-netflix-clone-05-client-model_transcript.pdfcreate-netflix-clone-05-client-model_transcript.pdf
create-netflix-clone-05-client-model_transcript.pdf
 
create-netflix-clone-03-server_transcript.pdf
create-netflix-clone-03-server_transcript.pdfcreate-netflix-clone-03-server_transcript.pdf
create-netflix-clone-03-server_transcript.pdf
 
create-netflix-clone-02-server.pdf
create-netflix-clone-02-server.pdfcreate-netflix-clone-02-server.pdf
create-netflix-clone-02-server.pdf
 
create-netflix-clone-05-client-model.pdf
create-netflix-clone-05-client-model.pdfcreate-netflix-clone-05-client-model.pdf
create-netflix-clone-05-client-model.pdf
 
Creating a Whatsapp Clone - Part II.pdf
Creating a Whatsapp Clone - Part II.pdfCreating a Whatsapp Clone - Part II.pdf
Creating a Whatsapp Clone - Part II.pdf
 
Creating a Whatsapp Clone - Part IX - Transcript.pdf
Creating a Whatsapp Clone - Part IX - Transcript.pdfCreating a Whatsapp Clone - Part IX - Transcript.pdf
Creating a Whatsapp Clone - Part IX - Transcript.pdf
 
Creating a Whatsapp Clone - Part II - Transcript.pdf
Creating a Whatsapp Clone - Part II - Transcript.pdfCreating a Whatsapp Clone - Part II - Transcript.pdf
Creating a Whatsapp Clone - Part II - Transcript.pdf
 
Creating a Whatsapp Clone - Part V - Transcript.pdf
Creating a Whatsapp Clone - Part V - Transcript.pdfCreating a Whatsapp Clone - Part V - Transcript.pdf
Creating a Whatsapp Clone - Part V - Transcript.pdf
 
Creating a Whatsapp Clone - Part IV - Transcript.pdf
Creating a Whatsapp Clone - Part IV - Transcript.pdfCreating a Whatsapp Clone - Part IV - Transcript.pdf
Creating a Whatsapp Clone - Part IV - Transcript.pdf
 
Creating a Whatsapp Clone - Part IV.pdf
Creating a Whatsapp Clone - Part IV.pdfCreating a Whatsapp Clone - Part IV.pdf
Creating a Whatsapp Clone - Part IV.pdf
 
Creating a Whatsapp Clone - Part I - Transcript.pdf
Creating a Whatsapp Clone - Part I - Transcript.pdfCreating a Whatsapp Clone - Part I - Transcript.pdf
Creating a Whatsapp Clone - Part I - Transcript.pdf
 

Recently uploaded

Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - HiikeSystem Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
Hiike
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
Intelisync
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
dbms calicut university B. sc Cs 4th sem.pdf
dbms  calicut university B. sc Cs 4th sem.pdfdbms  calicut university B. sc Cs 4th sem.pdf
dbms calicut university B. sc Cs 4th sem.pdf
Shinana2
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
LucaBarbaro3
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 

Recently uploaded (20)

Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - HiikeSystem Design Case Study: Building a Scalable E-Commerce Platform - Hiike
System Design Case Study: Building a Scalable E-Commerce Platform - Hiike
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
dbms calicut university B. sc Cs 4th sem.pdf
dbms  calicut university B. sc Cs 4th sem.pdfdbms  calicut university B. sc Cs 4th sem.pdf
dbms calicut university B. sc Cs 4th sem.pdf
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 

Adapting to Tablets and Desktops - Part 1.pdf

  • 1. Adapting to Tablets & Desktops - Part I
  • 2. © Codename One 2017 all rights reserved Before
  • 3. © Codename One 2017 all rights reserved After
  • 5. Architecture ✦In the current app every UI element derives from form and stands alone, in the tablet app we want to have one form for the entire app ✦Instead of deriving from Form we derive from a common base class ✦Every feature we need in Form is abstracted so we can keep common code together © Codename One 2017 all rights reserved
  • 6. public class BaseNavigationForm extends UIAbstraction { private static DishListForm dishForm; private static BillingForm billingForm; private static DetailsForm detailsForm; private static AppForm appForm; private static AboutForm aboutForm; private final AppSettings app; public BaseNavigationForm(AppSettings app, Layout l) { super(); this.app = app; initUI(Restaurant.getInstance().name.get(), l); } public static void showAppForm(AppSettings app) { if(appForm == null) { appForm = new AppForm(app); } appForm.show(); } BaseNavigationForm
  • 7. public class UIAbstraction { private Button okButton; class FormDelegate extends Form { public FormDelegate(String title, Layout l) { super(title, l); initToolbar(getToolbar()); if(hasOKBack()) { Form previousForm = Display.getInstance().getCurrent(); getToolbar().addMaterialCommandToLeftBar(“", FontImage.MATERIAL_ARROW_BACK, e -> { onBack(); previousForm.showBack(); }); Command cmd = getToolbar().addMaterialCommandToRightBar("", FontImage.MATERIAL_CHECK, e -> { onOK(); previousForm.showBack(); }); okButton = getToolbar().findCommandComponent(cmd); } } UIAbstraction
  • 8. public class UIAbstraction { private Button okButton; class FormDelegate extends Form { public FormDelegate(String title, Layout l) { super(title, l); initToolbar(getToolbar()); if(hasOKBack()) { Form previousForm = Display.getInstance().getCurrent(); getToolbar().addMaterialCommandToLeftBar(“", FontImage.MATERIAL_ARROW_BACK, e -> { onBack(); previousForm.showBack(); }); Command cmd = getToolbar().addMaterialCommandToRightBar("", FontImage.MATERIAL_CHECK, e -> { onOK(); previousForm.showBack(); }); okButton = getToolbar().findCommandComponent(cmd); } } UIAbstraction
  • 9. public class UIAbstraction { private Button okButton; class FormDelegate extends Form { public FormDelegate(String title, Layout l) { super(title, l); initToolbar(getToolbar()); if(hasOKBack()) { Form previousForm = Display.getInstance().getCurrent(); getToolbar().addMaterialCommandToLeftBar(“", FontImage.MATERIAL_ARROW_BACK, e -> { onBack(); previousForm.showBack(); }); Command cmd = getToolbar().addMaterialCommandToRightBar("", FontImage.MATERIAL_CHECK, e -> { onOK(); previousForm.showBack(); }); okButton = getToolbar().findCommandComponent(cmd); } } UIAbstraction
  • 10. public class UIAbstraction { private Button okButton; class FormDelegate extends Form { public FormDelegate(String title, Layout l) { super(title, l); initToolbar(getToolbar()); if(hasOKBack()) { Form previousForm = Display.getInstance().getCurrent(); getToolbar().addMaterialCommandToLeftBar(“", FontImage.MATERIAL_ARROW_BACK, e -> { onBack(); previousForm.showBack(); }); Command cmd = getToolbar().addMaterialCommandToRightBar("", FontImage.MATERIAL_CHECK, e -> { onOK(); previousForm.showBack(); }); okButton = getToolbar().findCommandComponent(cmd); } } UIAbstraction
  • 11. public class UIAbstraction { private Button okButton; class FormDelegate extends Form { public FormDelegate(String title, Layout l) { super(title, l); initToolbar(getToolbar()); if(hasOKBack()) { Form previousForm = Display.getInstance().getCurrent(); getToolbar().addMaterialCommandToLeftBar(“", FontImage.MATERIAL_ARROW_BACK, e -> { onBack(); previousForm.showBack(); }); Command cmd = getToolbar().addMaterialCommandToRightBar("", FontImage.MATERIAL_CHECK, e -> { onOK(); previousForm.showBack(); }); okButton = getToolbar().findCommandComponent(cmd); } } UIAbstraction
  • 12. protected Component createStatusBar() { Component c = super.createStatusBar(); c.setUIID("Container"); return c; } @Override protected void initGlobalToolbar() { if(Toolbar.isGlobalToolbar()) { setToolbar(new Toolbar(isLayeredToolbar()) { @Override protected void initTitleBarStatus() { } }); } } @Override protected boolean shouldPaintStatusBar() { return UIAbstraction.this.shouldPaintStatusBar(); } } UIAbstraction