From 2ffcd1c8484a12a68c36ee52f0f05331aa12e204 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 6 Mar 2019 15:25:58 +0300 Subject: [PATCH 1/2] some cleanup and notes... Signed-off-by: Alex A. Naanou --- ui (gen4)/lib/widget/browse2.js | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/ui (gen4)/lib/widget/browse2.js b/ui (gen4)/lib/widget/browse2.js index 7f5dfc47..ef6f85ab 100755 --- a/ui (gen4)/lib/widget/browse2.js +++ b/ui (gen4)/lib/widget/browse2.js @@ -253,6 +253,8 @@ var BaseBrowserPrototype = { noDuplicateValues: false, }, + // parent widget object... + // parent: null, // @@ -271,7 +273,7 @@ var BaseBrowserPrototype = { // // NOTE: this can't be a map/dict as we need both order manipulation // and nested structures which would overcomplicate things, as - // a compromise we use .item_index blow for item identification. + // a compromise we use .item_index below for item identification. __items: null, get items(){ this.__items @@ -287,12 +289,27 @@ var BaseBrowserPrototype = { // ... // } // + // NOTE: this will get overwritten each tume .make(..) is called. + // // XXX need to maintain this over item add/remove/change... // XXX Q: should we be able to add/remove/change items outside of .__list__(..)??? // ...only some item updates (how .collapsed is handled) make // sense at this time -- need to think about this more // carefully + strictly document the result... - item_index: null, + // XXX can we make the format here simpler with less level + // of indirection?? + // ...currently to go down a path we need to: + // this.item_index.A.sublist.item_index.B.sublist... + // would be nice to be closer to: + // this.A.B... + __item_index: null, + get item_index(){ + this.__item_index + || this.make() + return this.__item_index }, + set item_index(value){ + this.__item_index = value }, + // XXX what should these return??? (item, id, ...) __focused: undefined, @@ -374,8 +391,7 @@ var BaseBrowserPrototype = { //return JSON.stringify(key) return key instanceof Array ? key.join(' ') - : key - }, + : key }, // Key getter/generator... // @@ -409,7 +425,7 @@ var BaseBrowserPrototype = { - // Make .items... + // Make .items and .item_index... // // .make() // .make(options) @@ -432,8 +448,8 @@ var BaseBrowserPrototype = { options = options || this.options || {} var items = this.items = [] - var old_index = this.item_index || {} - var new_index = this.item_index = {} + var old_index = this.__item_index || {} + var new_index = this.__item_index = {} // item constructor... // @@ -674,6 +690,7 @@ var BaseBrowserPrototype = { // -> item // -> undefined // + // XXX add path support... get: function(key){ key = key == null ? 0 : key From c4e087cfe18c99a2a84bb6dbbced011173135792 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 6 Mar 2019 15:38:37 +0300 Subject: [PATCH 2/2] notes... Signed-off-by: Alex A. Naanou --- ui (gen4)/lib/widget/browse2.js | 1 + 1 file changed, 1 insertion(+) diff --git a/ui (gen4)/lib/widget/browse2.js b/ui (gen4)/lib/widget/browse2.js index ef6f85ab..5ff94f3f 100755 --- a/ui (gen4)/lib/widget/browse2.js +++ b/ui (gen4)/lib/widget/browse2.js @@ -255,6 +255,7 @@ var BaseBrowserPrototype = { // parent widget object... // + // NOTE: this may or may not be a Browser object. parent: null, //