From 068eda8a762ba7e1874af091421d3296c314f531 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Mon, 12 Aug 2013 14:21:35 -0700 Subject: [PATCH] Implement GuacUI.GroupView component for easy viewing of groups/connections. --- guacamole/src/main/webapp/index.xhtml | 3 - guacamole/src/main/webapp/scripts/guac-ui.js | 93 ++++++++++++++++++++ guacamole/src/main/webapp/scripts/root-ui.js | 71 +-------------- guacamole/src/main/webapp/styles/login.css | 3 +- 4 files changed, 98 insertions(+), 72 deletions(-) diff --git a/guacamole/src/main/webapp/index.xhtml b/guacamole/src/main/webapp/index.xhtml index ba719cff0..87d28b02b 100644 --- a/guacamole/src/main/webapp/index.xhtml +++ b/guacamole/src/main/webapp/index.xhtml @@ -83,9 +83,6 @@
-
-
-

Clipboard

diff --git a/guacamole/src/main/webapp/scripts/guac-ui.js b/guacamole/src/main/webapp/scripts/guac-ui.js index 46e5dcc8f..1a09c79ef 100644 --- a/guacamole/src/main/webapp/scripts/guac-ui.js +++ b/guacamole/src/main/webapp/scripts/guac-ui.js @@ -875,3 +875,96 @@ GuacUI.ListGroup = function(caption) { }; } + +/** + * Component which displays a paginated tree view of all groups and their + * connections. + * + * @constructor + * @param {GuacamoleService.ConnectionGroup} root_group The group to display + * within the view. + */ +GuacUI.GroupView = function(root_group) { + + /** + * Reference to this GroupView. + * @private + */ + var group_view = this; + + // Group view components + var element = GuacUI.createElement("div", "group-view"); + var list = GuacUI.createChildElement(element, "div", "list"); + + /** + * Set of all connections, indexed by ID. + */ + this.connections = {}; + + /** + * Returns the element representing this group view. + */ + this.getElement = function() { + return element; + }; + + // Create pager for contents + var pager = new GuacUI.Pager(list); + pager.page_capacity = 20; + + /** + * Adds the given group to the given display parent object. This object + * must have an addElement() function, which will be used for adding all + * child elements representing child connections and groups. + * + * @param {GuacamoleService.ConnectionGroup} group The group to add. + * @param {Function} appendChild A function which, given an element, will add that + * element the the display as desired. + */ + function addGroup(group, appendChild) { + + var i; + + // Add all contained connections + for (i=0; i