Questions ========= - Can the same dimension (type) be used as a row *and* column dimension at the same time? Key Concepts ============ - A dimension is always passed around as its JSON representation. - No two-way bindings on the settings data object itself! - Dimension components only used to work with settings, nothing else. - Composer only used to maintain lists of Dimension settings objects, nothing else. - A Dimension can be valid or invalid. - Only valid Dimensions are send to the application - => only valid Dimensions are stored in/known to the Composer Rules ===== - No function longer than 10 lines! Anywhere. reporting-dimension =================== ## Actions Interface - update *send after valid settings change, passes `this` (?)* - delete *send when dimension should be deleted, passes `this`* ## Actions - edit *toggles `isEditing`* - delete *delegates to `sendAction`* ## Properties - type *type of dimension, override in subclass* - caption *summary of current setting, override in subclass* - isValid *boolean flag, result of validation* - isEditing *boolean flag, state of editing* - settings *object to hold all define-able dimension settings* ## Methods - validate *checks that all `settings` are valid, sets & returns `isValid`* - toJSON *returns a consumable representation of this dimension in JSON* carries-dimension **extends reporting-dimension** *(Example)* ================= ## Properties - type *override, set to 'Carriers'* - caption *override, set to CP based on `settings` to show summary* ## Methods - validate *override, check carriers-specific `settings`* - toJSON *override, compose carriers-specific JSON representation* table-composer ============== ## Actions Interface - save *send when the current state of the composer should be saved* - update *send when `rows` or `cols` changed, i.e. after `add`, `update`, `delete`* ## Actions - add(where, type) *(rows|cols), (dimension type). pushes a new dimension object* - update(dim) *the dim settings object. updates its own copy in `rows`/`cols` with `dim`* - delete(dim) *the dim settings object. removes `dim` from its `rows`/`cols`* - save *gathers and concats all its `rows`/`cols` data, delegates to `sendAction`* ## Properties - rows *array, all row dimension objects* - cols *array, all column dimension objects* - dimensions *array, all defined dimensions* ## Methods - toJSON *returns a nice representation of its current `rows` and `cols`*