factor/core/ui/handbook/models.facts

57 lines
2.4 KiB
Plaintext

USING: help gadgets gadgets-search models ;
ARTICLE: "models" "Models"
"The Factor UI provides basic support for dataflow programming via " { $emphasis "models" } " and " { $emphasis "controls" } ". A model is an observable value. Changing a model's value notifies other objects which depend on the model automatically, and models may depend on each other's values. A " { $link control } " is a " { $link gadget } " displaying a model."
{ $subsection model }
"Creating models:"
{ $subsection <model> }
"Adding and removing connections:"
{ $subsection add-connection }
{ $subsection remove-connection }
"Generic word called on model connections when the model value changes:"
{ $subsection model-changed }
"When using models which are not associated with controls (or when unit testing controls), you must activate and deactivate models manually:"
{ $subsection activate-model }
{ $subsection deactivate-model }
"Special types of models:"
{ $subsection "models-filter" }
{ $subsection "models-compose" }
{ $subsection "models-history" }
{ $subsection "models-delay" }
{ $subsection "models-impl" } ;
ARTICLE: "models-filter" "Filter models"
"Filter model values are computed by applying a quotation to the value of another model."
{ $subsection filter }
{ $subsection <filter> } ;
ARTICLE: "models-compose" "Composed models"
"Composed model values are computed by collecting the values from a sequence of underlying models into a new sequence."
{ $subsection compose }
{ $subsection <compose> } ;
ARTICLE: "models-history" "History models"
"History models record previous values."
{ $subsection history }
{ $subsection <history> }
"Recording history:"
{ $subsection add-history }
"Navigating the history:"
{ $subsection go-back }
{ $subsection go-forward } ;
ARTICLE: "models-delay" "Delay models"
"Delay models are used to implement delayed updating of gadgets in response to user input. For example, " { $link live-search } " instances use delay models perform the search only after the user stops typing."
{ $subsection delay }
{ $subsection <delay> } ;
ARTICLE: "models-impl" "Implementing models"
"New types of models can be defined, along the lines of " { $link filter } " and such."
$terpri
"Tuples can delegate to models:"
{ $subsection delegate>model }
"Models can execute hooks when activated:"
{ $subsection model-activated }
"Models can override requests to change their value, for example to perform validation:"
{ $subsection set-model } ;