# CSE 340 Lab 5 (Winter 2020) ## Week 5: Midterm Review --- # Logistics and Agenda - Midterm Logistics - Double-sided, note sheet, handwritten - When: During class, please arrive before the class starts - Where: Same classroom - Agenda - Review Layout and Accessibility Quizzes - Understanding State Machines - Questions --- # Layout Question 1 Which of the following widgets is likely to have a minimum and maximum height that are the same? - **Horizontal scrollbar** - Menu - Button - Text entry area The height of the horizontal scrollbar is usually absolute. Should the horizontal scrollbar height change if we changed the dimensions of the entire view? --- # Layout Question 2 Which of the following is not an event? - **Ctrl [key pressed]** - Click [of mouse] - WindowOpen - 4 [key pressed] --- # Layout Question 3 Assume the following structure. There are two modes, with or without labels. Which view should be used for the following layout. - **Constraint Layout** - Absolute Layout - Linear Layout ![:img quiz layout image, 70%](img/layout.png) --- # Accessibility Question 1 You have created a new driving app. You have registered your app to listen for OffRoute callbacks (when the driver’s vehicle deviates from the route, onOffRoute() will be called). Correctly label each method call, based on what object (Application or View) you would use to call it, and where you would put the code to implement it. Please answer the following questions using Application, View, or Neither as your answers. onOffRoute() is called by **Neither (Toolkit Architecture)**and implemented in **Application** ![:img event diagram, 50%](img/eventDiagram.png) --- # Accessibility Question 1 You have created a new driving app. You have registered your app to listen for OffRoute callbacks (when the driver’s vehicle deviates from the route, onOffRoute() will be called). Correctly label each method call, based on what object (Application or View) you would use to call it, and where you would put the code to implement it. Please answer the following questions using Application, View, or Neither as your answers. setOnOffRouteListener() is called by **Application** and implemented in **Neither** The application is listening for OffRoute so it sets a listener. set*Listener() are separate from the Application and View. --- # State Machine Recap - State Machines are used to respond to incoming events and allows for us to store state between events. - Start state - indicated with incoming arrow - End state - indicated with double-layered shape - Transition States - indicated with single-layered shape - Event Arrows - indicated with an arrow between states, represent different actions taken up states. ![:img State Machine Diagram Recap, 50%](img/smrecap.png) --- # State Machines Question What is the behavior of this State Machine? ![:img State Machine Diagram Question, 60%](img/smq.png)