Confirmed users, Bureaucrats and Sysops emeriti
2,088
edits
| Line 23: | Line 23: | ||
code, this is controller.js. | code, this is controller.js. | ||
The extent to which these services are kept independent can be seen in | The extent to which these services are kept independent can be seen in the following details: | ||
the following details: | |||
* The Model does not in general deal with presentation. | * The Model does not in general deal with presentation. | ||
* The Controller knows of "selection" only as a concept abstract from the details of the selected View (e.g. a complex tree selection versus a selected toolbar button or menu item). As far as the Controller is concerned, the selection is a list of Result Nodes, there are no View-specific selection ranges, etc. | * The Controller knows of "selection" only as a concept abstract from the details of the selected View (e.g. a complex tree selection versus a selected toolbar button or menu item). As far as the Controller is concerned, the selection is a list of Result Nodes, there are no View-specific selection ranges, etc. | ||
* The Views know nothing about the functions performed when the user interacts with their content, since that is instance specific. The Views implement a View Interface which handle translating their unique selection characteristics into an agnostic form the Controller can deal with. | * The Views know nothing about the functions performed when the user interacts with their content, since that is instance specific. The Views implement a View Interface which handle translating their unique selection characteristics into an agnostic form the Controller can deal with. | ||
The idea is that someone can instantiate a View, attach a Controller, and | The idea is that someone can instantiate a View, attach a Controller, and define the behavioral characteristics that suit their use, in very little code. Examples: | ||
define the behavioral characteristics that suit their use, in very | |||
little code. Examples: | |||
'''Bookmarks Menu''' | '''Bookmarks Menu''' | ||
| Line 41: | Line 38: | ||
'''Folder Selector''' | '''Folder Selector''' | ||
* instantiate a Menu View, attached to a menulist in the Places Search | * instantiate a Menu View, attached to a menulist in the Places Search popup. | ||
popup. | |||
* attach the Controller | * attach the Controller | ||
* attach a command event listener that handles user clicks in the menu | * attach a command event listener that handles user clicks in the menu by re-rooting a Tree View elsewhere in the UI | ||
by re-rooting a Tree View elsewhere in the UI | |||
* root the View on a Model query result, and tell it to populate itself. | * root the View on a Model query result, and tell it to populate itself. | ||