SlideShare a Scribd company logo
Architecture - Part II
Label currentOrderValue = new Label("Your Order: " +
Restaurant.getInstance().formatCurrency(0),
"YourOrder");
Restaurant.getInstance().cart.get().
dishesQuantity.addChangeListener(pl -> {
double totalPriceValue = 0;
for(Map.Entry<Dish, Integer> currentDish :
Restaurant.getInstance().cart.get().dishesQuantity) {
totalPriceValue += (currentDish.getKey().price.get() *
currentDish.getValue());
}
currentOrderValue.setText("Your Order: " +
Restaurant.getInstance().
formatCurrency(totalPriceValue));
revalidate();
});
Base Form
Label currentOrderValue = new Label("Your Order: " +
Restaurant.getInstance().formatCurrency(0),
"YourOrder");
Restaurant.getInstance().cart.get().
dishesQuantity.addChangeListener(pl -> {
double totalPriceValue = 0;
for(Map.Entry<Dish, Integer> currentDish :
Restaurant.getInstance().cart.get().dishesQuantity) {
totalPriceValue += (currentDish.getKey().price.get() *
currentDish.getValue());
}
currentOrderValue.setText("Your Order: " +
Restaurant.getInstance().
formatCurrency(totalPriceValue));
revalidate();
});
Base Form
private void updatePrice() {
double totalPriceValue = 0;
for(Map.Entry<Dish, Integer> currentDish :
Restaurant.getInstance().cart.get().dishesQuantity) {
totalPriceValue += (currentDish.getKey().price.get() * currentDish.getValue());
}
totalPrice.setText("Total: " + Restaurant.getInstance().formatCurrency(totalPriceValue));
totalPrice.getParent().revalidate();
}
private Container createShoppingCartContainer(Dish di, int quantity) {
// snipped…
Container dishContainer = BoxLayout.encloseX(
FlowLayout.encloseMiddle(quantityButton),
new Label(di.thumbnail.get(), "UnmarginedLabel"),
FlowLayout.encloseMiddle(
BoxLayout.encloseY(
new Label(di.name.get(), "DishCheckoutTitle"),
new Label(Restaurant.getInstance().formatCurrency(di.price.get()), "CheckoutPrice")
)
)
);
Checkout Form
quantityButton.addActionListener(e -> {
if(quantityButton.getSelectedString().equals(PICKER_STRINGS[0])) {
Display.getInstance().callSerially(() -> {
dishContainer.setX(Display.getInstance().getDisplayWidth());
Container p = dishContainer.getParent();
p.animateUnlayoutAndWait(250, 255);
dishContainer.remove();
p.animateLayoutAndWait(200);
updatePrice();
});
} else {
updatePrice();
}
});
return dishContainer;
}
Checkout Form
Restaurant r = Restaurant.getInstance();
Coord crd = new Coord(r.latitude.get(), r.longitude.get());
MapContainer map = new MapContainer(“google-key");
map.addMarker(null, crd, r.name.get(), r.tagline.get(), null);
map.setCameraPosition(crd);
TextArea address = new TextArea(r.address.get());
address.setEditable(false);
address.setUIID("MapAddressText");
Button phone = new Button("", "ShoppingCart");
FontImage.setMaterialIcon(phone, FontImage.MATERIAL_CALL);
phone.addActionListener(e -> Display.getInstance().dial(r.phone.get()));
Button navigate = new Button("", "ShoppingCart");
FontImage.setMaterialIcon(navigate, FontImage.MATERIAL_NAVIGATION);
navigate.addActionListener(e ->
Display.getInstance().openNativeNavigationApp(r.navigationAddress.get()));
Contact Us Form
List<String> l = new List<String>(new DefaultListModel<>(
Restaurant.getInstance().
menu.get().
categories.asList()))
protected Container createContent() {
Container c = new Container(BoxLayout.y());
for(Dish currentDish : Restaurant.getInstance().menu.get().dishes) {
c.add(createDishContainer(currentDish));
}
c.setScrollableY(true);
c.setScrollVisible(false);
return c;
}
order.addActionListener(e -> {
Order o = Restaurant.getInstance().cart.get();
if(o.dishesQuantity.get(dish) != null) {
o.dishesQuantity.put(dish, o.dishesQuantity.get(dish) + 1);
} else {
o.dishesQuantity.put(dish, 1);
}
});
Main Menu Form
List<String> l = new List<String>(new DefaultListModel<>(
Restaurant.getInstance().
menu.get().
categories.asList()))
protected Container createContent() {
Container c = new Container(BoxLayout.y());
for(Dish currentDish : Restaurant.getInstance().menu.get().dishes) {
c.add(createDishContainer(currentDish));
}
c.setScrollableY(true);
c.setScrollVisible(false);
return c;
}
order.addActionListener(e -> {
Order o = Restaurant.getInstance().cart.get();
if(o.dishesQuantity.get(dish) != null) {
o.dishesQuantity.put(dish, o.dishesQuantity.get(dish) + 1);
} else {
o.dishesQuantity.put(dish, 1);
}
});
Main Menu Form
List<String> l = new List<String>(new DefaultListModel<>(
Restaurant.getInstance().
menu.get().
categories.asList()))
protected Container createContent() {
Container c = new Container(BoxLayout.y());
for(Dish currentDish : Restaurant.getInstance().menu.get().dishes) {
c.add(createDishContainer(currentDish));
}
c.setScrollableY(true);
c.setScrollVisible(false);
return c;
}
order.addActionListener(e -> {
Order o = Restaurant.getInstance().cart.get();
if(o.dishesQuantity.get(dish) != null) {
o.dishesQuantity.put(dish, o.dishesQuantity.get(dish) + 1);
} else {
o.dishesQuantity.put(dish, 1);
}
});
Main Menu Form
What did we learn?
✦Designing an object model is easier when we
already built the UI
✦Top -> Bottom is a very convenient way to quickly
build an app
Thank You!

More Related Content

PDF
Architecture - Part 2 - Transcript.pdf
PDF
UI Design From Scratch - Part 5.pdf
PDF
Miscellaneous Features - Part 1 - Transcript.pdf
PDF
Miscellaneous Features - Part 1.pdf
PDF
Architecture - Part 1.pdf
PDF
UI Design From Scratch - Part 5 - transcript.pdf
PDF
Initial UI Mockup - Part 3 - Transcript.pdf
PDF
Architecture - Part 1 - Transcript.pdf
Architecture - Part 2 - Transcript.pdf
UI Design From Scratch - Part 5.pdf
Miscellaneous Features - Part 1 - Transcript.pdf
Miscellaneous Features - Part 1.pdf
Architecture - Part 1.pdf
UI Design From Scratch - Part 5 - transcript.pdf
Initial UI Mockup - Part 3 - Transcript.pdf
Architecture - Part 1 - Transcript.pdf

Similar to Architecture - Part 2.pdf (20)

PDF
Extracting ui Design - part 5 - transcript.pdf
PDF
Finishing the App - Part 1.pdf
DOCX
project_additionsCuisineType.javaproject_additionsCuisineType..docx
PDF
Miscellaneous Features - Part 2 - Transcript.pdf
PDF
Extracting ui Design - part 5.pdf
PDF
Initial UI Mockup - Part 3.pdf
PDF
Miscellaneous Features - Part 3 - Transcript.pdf
PDF
Adapting to Tablets and Desktops - Part 3.pdf
PDF
Finishing the App - Part 1 - Transcript.pdf
PDF
What's for Lunch?
PPTX
Final year project presentation in android application
PDF
public class FullListException extends Exception { Default .pdf
PDF
Adapting to Tablets and Desktops - Part 3 - Transcript.pdf
PDF
SQLite and ORM Binding - Part 1.pdf
PDF
Miscellaneous Features - Part 2.pdf
DOCX
Best design for your site - tips
PDF
Hello everyone,Im working on my fast food order project program..pdf
PDF
SQLite and ORM Binding - Part 1 - Transcript.pdf
PDF
How to create an array restaurant menu out of the main class using m.pdf
PPTX
Android App: Restaurant info
Extracting ui Design - part 5 - transcript.pdf
Finishing the App - Part 1.pdf
project_additionsCuisineType.javaproject_additionsCuisineType..docx
Miscellaneous Features - Part 2 - Transcript.pdf
Extracting ui Design - part 5.pdf
Initial UI Mockup - Part 3.pdf
Miscellaneous Features - Part 3 - Transcript.pdf
Adapting to Tablets and Desktops - Part 3.pdf
Finishing the App - Part 1 - Transcript.pdf
What's for Lunch?
Final year project presentation in android application
public class FullListException extends Exception { Default .pdf
Adapting to Tablets and Desktops - Part 3 - Transcript.pdf
SQLite and ORM Binding - Part 1.pdf
Miscellaneous Features - Part 2.pdf
Best design for your site - tips
Hello everyone,Im working on my fast food order project program..pdf
SQLite and ORM Binding - Part 1 - Transcript.pdf
How to create an array restaurant menu out of the main class using m.pdf
Android App: Restaurant info

More from ShaiAlmog1 (20)

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

Recently uploaded (20)

PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Spectroscopy.pptx food analysis technology
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Electronic commerce courselecture one. Pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Cloud computing and distributed systems.
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
KodekX | Application Modernization Development
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Encapsulation theory and applications.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Network Security Unit 5.pdf for BCA BBA.
Per capita expenditure prediction using model stacking based on satellite ima...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Spectroscopy.pptx food analysis technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Programs and apps: productivity, graphics, security and other tools
“AI and Expert System Decision Support & Business Intelligence Systems”
Electronic commerce courselecture one. Pdf
Spectral efficient network and resource selection model in 5G networks
Cloud computing and distributed systems.
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Chapter 3 Spatial Domain Image Processing.pdf
KodekX | Application Modernization Development
Diabetes mellitus diagnosis method based random forest with bat algorithm
Encapsulation theory and applications.pdf
MYSQL Presentation for SQL database connectivity
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Reach Out and Touch Someone: Haptics and Empathic Computing
Unlocking AI with Model Context Protocol (MCP)
Network Security Unit 5.pdf for BCA BBA.

Architecture - Part 2.pdf

  • 2. Label currentOrderValue = new Label("Your Order: " + Restaurant.getInstance().formatCurrency(0), "YourOrder"); Restaurant.getInstance().cart.get(). dishesQuantity.addChangeListener(pl -> { double totalPriceValue = 0; for(Map.Entry<Dish, Integer> currentDish : Restaurant.getInstance().cart.get().dishesQuantity) { totalPriceValue += (currentDish.getKey().price.get() * currentDish.getValue()); } currentOrderValue.setText("Your Order: " + Restaurant.getInstance(). formatCurrency(totalPriceValue)); revalidate(); }); Base Form
  • 3. Label currentOrderValue = new Label("Your Order: " + Restaurant.getInstance().formatCurrency(0), "YourOrder"); Restaurant.getInstance().cart.get(). dishesQuantity.addChangeListener(pl -> { double totalPriceValue = 0; for(Map.Entry<Dish, Integer> currentDish : Restaurant.getInstance().cart.get().dishesQuantity) { totalPriceValue += (currentDish.getKey().price.get() * currentDish.getValue()); } currentOrderValue.setText("Your Order: " + Restaurant.getInstance(). formatCurrency(totalPriceValue)); revalidate(); }); Base Form
  • 4. private void updatePrice() { double totalPriceValue = 0; for(Map.Entry<Dish, Integer> currentDish : Restaurant.getInstance().cart.get().dishesQuantity) { totalPriceValue += (currentDish.getKey().price.get() * currentDish.getValue()); } totalPrice.setText("Total: " + Restaurant.getInstance().formatCurrency(totalPriceValue)); totalPrice.getParent().revalidate(); } private Container createShoppingCartContainer(Dish di, int quantity) { // snipped… Container dishContainer = BoxLayout.encloseX( FlowLayout.encloseMiddle(quantityButton), new Label(di.thumbnail.get(), "UnmarginedLabel"), FlowLayout.encloseMiddle( BoxLayout.encloseY( new Label(di.name.get(), "DishCheckoutTitle"), new Label(Restaurant.getInstance().formatCurrency(di.price.get()), "CheckoutPrice") ) ) ); Checkout Form
  • 5. quantityButton.addActionListener(e -> { if(quantityButton.getSelectedString().equals(PICKER_STRINGS[0])) { Display.getInstance().callSerially(() -> { dishContainer.setX(Display.getInstance().getDisplayWidth()); Container p = dishContainer.getParent(); p.animateUnlayoutAndWait(250, 255); dishContainer.remove(); p.animateLayoutAndWait(200); updatePrice(); }); } else { updatePrice(); } }); return dishContainer; } Checkout Form
  • 6. Restaurant r = Restaurant.getInstance(); Coord crd = new Coord(r.latitude.get(), r.longitude.get()); MapContainer map = new MapContainer(“google-key"); map.addMarker(null, crd, r.name.get(), r.tagline.get(), null); map.setCameraPosition(crd); TextArea address = new TextArea(r.address.get()); address.setEditable(false); address.setUIID("MapAddressText"); Button phone = new Button("", "ShoppingCart"); FontImage.setMaterialIcon(phone, FontImage.MATERIAL_CALL); phone.addActionListener(e -> Display.getInstance().dial(r.phone.get())); Button navigate = new Button("", "ShoppingCart"); FontImage.setMaterialIcon(navigate, FontImage.MATERIAL_NAVIGATION); navigate.addActionListener(e -> Display.getInstance().openNativeNavigationApp(r.navigationAddress.get())); Contact Us Form
  • 7. List<String> l = new List<String>(new DefaultListModel<>( Restaurant.getInstance(). menu.get(). categories.asList())) protected Container createContent() { Container c = new Container(BoxLayout.y()); for(Dish currentDish : Restaurant.getInstance().menu.get().dishes) { c.add(createDishContainer(currentDish)); } c.setScrollableY(true); c.setScrollVisible(false); return c; } order.addActionListener(e -> { Order o = Restaurant.getInstance().cart.get(); if(o.dishesQuantity.get(dish) != null) { o.dishesQuantity.put(dish, o.dishesQuantity.get(dish) + 1); } else { o.dishesQuantity.put(dish, 1); } }); Main Menu Form
  • 8. List<String> l = new List<String>(new DefaultListModel<>( Restaurant.getInstance(). menu.get(). categories.asList())) protected Container createContent() { Container c = new Container(BoxLayout.y()); for(Dish currentDish : Restaurant.getInstance().menu.get().dishes) { c.add(createDishContainer(currentDish)); } c.setScrollableY(true); c.setScrollVisible(false); return c; } order.addActionListener(e -> { Order o = Restaurant.getInstance().cart.get(); if(o.dishesQuantity.get(dish) != null) { o.dishesQuantity.put(dish, o.dishesQuantity.get(dish) + 1); } else { o.dishesQuantity.put(dish, 1); } }); Main Menu Form
  • 9. List<String> l = new List<String>(new DefaultListModel<>( Restaurant.getInstance(). menu.get(). categories.asList())) protected Container createContent() { Container c = new Container(BoxLayout.y()); for(Dish currentDish : Restaurant.getInstance().menu.get().dishes) { c.add(createDishContainer(currentDish)); } c.setScrollableY(true); c.setScrollVisible(false); return c; } order.addActionListener(e -> { Order o = Restaurant.getInstance().cart.get(); if(o.dishesQuantity.get(dish) != null) { o.dishesQuantity.put(dish, o.dishesQuantity.get(dish) + 1); } else { o.dishesQuantity.put(dish, 1); } }); Main Menu Form
  • 10. What did we learn? ✦Designing an object model is easier when we already built the UI ✦Top -> Bottom is a very convenient way to quickly build an app