cs349 - s10 - Lecture 13
CS349 -
Implementing User Interfaces - Spring 2010
Public Service Annoucements
-
Lecture 13 - State Machines
Encapsulation
The file chooser in Amaya is a container containing eight components
- two text editors,
- two menus, and
- four buttons.
Can we make a state diagram with a reasonable number of states?
High level view
- Clicking Browse button in Open dialogue does two things
- create a file chooser component
- gives the file chooser input focus (keyboard)
- Clicking Confirm button in File Chooser dialogue does three things
- dispose of the File Chooser
- insert the chosen file name into the Open Dialogue
- returns input focus to Open Dialogue
- Clicking Cancel button in File Chooser dialogue does two things
- dispose of File Chooser
- returns input focus to Open Dialogue
Possible two state solution
Aside on Focus
Talking about the BWS and window managers we were very casual about
focus.
- Focus determines which application(s) get input from
- the mouse
- the keyboard
- Focus can be split, so there are actually two foci
- Every window system has a focus policy.
- Mouse focus
- Mouse events go to the window the mouse is in, except
...
- Note MouseEnter, MouseExit
- Keyboard focus
- Either keyboard events go to the window the mouse is in,
- Or keyboard events get a new focus only when a mouse button is
clicked
- The window manager's focus can be overridden by an application.
- which is what's going on in the Open/File Chooser dialogues
End of Aside
Similar view of the File Chooser
Simplify to
- one text editor
- two menus
- three buttons
Buttons:
- Confirm
- Clear: remove all text from the editor
- Cancel
Possible five state solution
Similar view of the Folder Menu
N menu entries
- N+1 states (extra state is outside)
- N MouseEnter events
- One MouseExit events
- Response to Mouse Buttons varies
Each menu entry is a button, and you know how they work.
And the File Menu
As above.
What is the difference between the file menu and the folder menu?
- At what level should it appear?
Similar View of the Text Editor
Left as an exercise for the reader.
Assignment 2
Return to: