From 7641b95538d9fdca6bc0c615c23283a2033ff3dc Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 28 Jun 2015 05:36:40 +0300 Subject: [PATCH] some refactoring and docs updated... Signed-off-by: Alex A. Naanou --- ui (gen4)/experiments/browse-dialog.js | 28 +++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/ui (gen4)/experiments/browse-dialog.js b/ui (gen4)/experiments/browse-dialog.js index 54daa376..2a3da64b 100755 --- a/ui (gen4)/experiments/browse-dialog.js +++ b/ui (gen4)/experiments/browse-dialog.js @@ -21,6 +21,7 @@ define(function(require){ var module = {} var object = require('../object') + /*********************************************************************/ // helpers... @@ -32,6 +33,7 @@ function proxyToDom(name){ } + /*********************************************************************/ // NOTE: the widget itself does not need a title, that's the job for @@ -90,6 +92,8 @@ var BrowserClassPrototype = { }, } + + // XXX Q: should we make a base list dialog and build this on that or // simplify this to implement a list (removing the path and disabling // traversal)?? @@ -148,6 +152,7 @@ var BrowserPrototype = { '/', 'A', + // let the system handle copy paste... 'C', 'V', 'X', @@ -172,6 +177,7 @@ var BrowserPrototype = { '/', 'A', + // let the system handle copy paste... 'C', 'V', 'X', @@ -342,16 +348,18 @@ var BrowserPrototype = { set path(value){ return this.update(value) }, + // String path... + // + // NOTE: the setter is just a shorthand to .path setter for uniformity... get strPath(){ return '/' + this.path.join('/') }, - // NOTE: this is just a shorthand to .path for uniformity... set strPath(value){ this.path = value }, - // Copy/Paste... + // Copy/Paste actions... // // XXX use 'Test' for IE... copy: function(){ @@ -1043,8 +1051,8 @@ var BrowserPrototype = { // Push an element to path / go down one level... // - // XXX trigger a "push" event... (???) // XXX might be a good idea to add a live traversable check... + // XXX revise event... push: function(elem){ var browser = this.dom var elem = this.select(elem || '!') @@ -1061,8 +1069,13 @@ var BrowserPrototype = { } var path = this.path + var txt = elem.text() path.push(elem.text()) + // XXX should this be before or after the actual path update??? + // XXX can we cancel the update from a handler??? + this.trigger('push', path) + // do the actual traverse... this.path = path @@ -1073,7 +1086,7 @@ var BrowserPrototype = { // Pop an element off the path / go up one level... // - // XXX trigger a "pop" event... (???) + // XXX revise event... pop: function(){ var browser = this.dom @@ -1084,6 +1097,10 @@ var BrowserPrototype = { var path = this.path var dir = path.pop() + // XXX should this be before or after the actual path update??? + // XXX can we cancel the update from a handler??? + this.trigger('pop', path) + this.update(path) this.select('"'+dir+'"') @@ -1116,7 +1133,8 @@ var BrowserPrototype = { }, - // extension methods... + // Extension methods... + // ...these are resolved from .options // Open action... //