21.07.2013 Views

User Interface Design and Ergonomics - National Open University of ...

User Interface Design and Ergonomics - National Open University of ...

User Interface Design and Ergonomics - National Open University of ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3.5 CONSTRAINTS<br />

Constraints are relationships expressed by the programmer <strong>and</strong> automatically maintained<br />

by the UI toolkit.<br />

3.5.1 USES<br />

a. Layout:- Constraints are used in Layout to express the relationships between<br />

interface items. For example,<br />

field.left = label.right + 10<br />

b. Value propagation:- They are used for an action to be invoked when a value is<br />

entered or reached. An example is<br />

deleteAction.enabled = (selection != null)<br />

c. Synchronization <strong>of</strong> views to models:- Constraints are used to expressed the<br />

relationships between models.<br />

d. Interaction:- They are also used to express interaction such as<br />

rect.corner = mouse<br />

3.6 TYPES OF CONSTRAINTS<br />

a. One-Way Constraints<br />

Also called formulas, after spreadsheet<br />

Y= f(x1,x2,x3, …)<br />

Y depends on (points to ) x1,x2,x3, …<br />

Algorithms<br />

Data-driven<br />

Reevaluate formulas when a value is changed<br />

Dem<strong>and</strong>-driven<br />

Reevaluate formulas whenever a value is requested<br />

Lazy<br />

When dependent value changes, invalidate all values that depend on it.<br />

When invalid value is requested, recalculate it<br />

b. Variants<br />

Multi-output formulas<br />

(y1,y2, …) = f(x1,x2,x3, …)<br />

Cyclic dependencies<br />

Detect cycles <strong>and</strong> break them<br />

150

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!