From: Foster T. B. <fbr...@ad...> - 2006-10-17 23:32:02
|
Hey all, I wanted to email the group regarding something I'm implementing for =20 the preset widget, because I think it can be lifted into the View =20 Concept as a whole. A while back Mat and I were talking about the following problem: what =20= is the proper behavior of a view when it is asked to display a value =20 it cannot display? As an example, let us say I have an 'analog clock' =20= display and it is asked to show the time 25:75. What should the clock =20= do? To solve this, (thus far) we came up with the idea that every =20 view should have a singleton state. The singleton state for a view is =20= entirely implementation-specific; for instance in the clock example, =20 the view could set itself to noon and make the clock have a red =20 background -- something obvious to the user that says "I no longer =20 accurately reflect the value in the model I have been asked to =20 display". The instant the model communicates to the view a new value =20 that it can display, the view should display the new value normally. The notion of a 'singleton value' does not exist, so the ability for =20 the user to put a widget into the singleton state is prohibited. What =20= would trigger the singleton value for a view usually takes the form =20 of controller 'A' setting the value of a cell that view 'B' (also =20 bound to the cell) cannot display. The value would be valid for A as =20 a controller but not B as a view, so B reverts to the singleton state. Therefore, in the case when the view is also a controller (aka a =20 widget), there is an additional requirement to be placed on the =20 widget while in the singleton state. In addition to the above view =20 requirement, the widget must also allow for valid user manipulation =20 of the controller while displaying the singleton state. In the clock =20 example above, (should the clock view be part of a clock widget), the =20= singleton state should allow for the user to set another (valid) time =20= (for example, by dragging the hands of the clock with the mouse). As a more concrete example, I am reworking the ASL preset widget so =20 it models the View concept -- it is bound to a 'result' cell of the =20 property model. When the result cell is updated, the preset widget =20 compares its list of available presets against the result cell -- =20 when a preset is found whose contents are a subset of the result =20 cell, that preset is selected. The singleton state, then, occurs when =20= the result cell is in a state for which no preset exists. The display =20= behavior I am implementing is to append a menu item named "Custom" to =20= the preset category list. This will still let the user select a new =20 preset category from the preset category list, but at the same time =20 clearly tells the user "the dialog as it stands matches no presets." Thoughts? Blessings, Foster -- Foster T. Brereton <=E1=BC=B0=CF=87=CE=B8=CF=8D=CF=82>< = Romans =20 3:21-26 A d o b e S o f t w a r e T e c h n o l o g y L a b "What 99 percent of programmers need to know is not how to build =20 components but how to use them." -- Alexander Stepanov "Now we have very simple code and the meaning is perfectly clear. =20 Drink the Kool-Aid" -- Sean Parent |