From 8bc3c99b943419c0b8ae7af85bb714036961dbc1 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 4 Oct 2010 00:46:26 -0400 Subject: [PATCH] Start listening for the event to detect path component changes. --- web_frontend/path_control.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/web_frontend/path_control.js b/web_frontend/path_control.js index 1897b98..38701a6 100644 --- a/web_frontend/path_control.js +++ b/web_frontend/path_control.js @@ -93,7 +93,7 @@ armadillo.PathControl.prototype.decorateInternal = function(element) { goog.array.removeAt(components, components.length - 1); } - var path = ''; + var path = '/'; goog.array.forEach(components, function (part, i) { if (i != components.length - 1) { this.addChild(this.createComponentNode_(path, part), true); @@ -117,6 +117,8 @@ armadillo.PathControl.prototype.createComponentNode_ = function(path, name) { menu.setFilterLabel(name); menu.setAllowMultiple(false); menu.setOpenFollowsHighlight(true); + goog.events.listen(menu, goog.ui.Component.EventType.ACTION, + this.componentChanged_, false, this); this.fetchMenuContents_(path, name, menu); var button = new goog.ui.MenuButton(name, menu, null, this.dom_); @@ -151,6 +153,7 @@ armadillo.PathControl.prototype.fetchMenuContents_ = function(path, name, menu) return; } var item = new goog.ui.MenuItem(caption); + item.setValue(path + caption); menu.addItem(item); if (caption == name) { menu.setHighlighted(item); @@ -159,3 +162,11 @@ armadillo.PathControl.prototype.fetchMenuContents_ = function(path, name, menu) }; app.sendRequest('list', {'path':path}, callback); }; + +/** + * Handler for changing a component of the control. + * @param {Event} e + */ +armadillo.PathControl.prototype.componentChanged_ = function(e) { + console.log(e.target.getValue()); +}; -- 2.43.5