diff options
author | 2017-05-04 07:48:42 -0400 | |
---|---|---|
committer | 2017-05-04 12:28:17 -0400 | |
commit | b54df0ddd0c6a0372327c5aa3668e5a6458fcd64 (patch) | |
tree | e69cfa9b314a801bd187cf0145d1d4306436229c /ecomp-portal-FE/client/bower_components/jqTree/src/select_node_handler.coffee | |
parent | 39d1e62c84041831bfc52cca73b5ed5efaf57d27 (diff) |
[PORTAL-7] Rebase
This rebasing includes common libraries and common overlays projects
abstraction of components
Change-Id: I9a24a338665c7cd058978e8636bc412d9e2fdce8
Signed-off-by: st782s <statta@research.att.com>
Diffstat (limited to 'ecomp-portal-FE/client/bower_components/jqTree/src/select_node_handler.coffee')
-rw-r--r-- | ecomp-portal-FE/client/bower_components/jqTree/src/select_node_handler.coffee | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/ecomp-portal-FE/client/bower_components/jqTree/src/select_node_handler.coffee b/ecomp-portal-FE/client/bower_components/jqTree/src/select_node_handler.coffee deleted file mode 100644 index 1c1fe582..00000000 --- a/ecomp-portal-FE/client/bower_components/jqTree/src/select_node_handler.coffee +++ /dev/null @@ -1,84 +0,0 @@ -$ = jQuery - - -class SelectNodeHandler - constructor: (tree_widget) -> - @tree_widget = tree_widget - @clear() - - getSelectedNode: -> - selected_nodes = @getSelectedNodes() - - if selected_nodes.length - return selected_nodes[0] - else - return false - - getSelectedNodes: -> - if @selected_single_node - return [@selected_single_node] - else - selected_nodes = [] - - for id of @selected_nodes - node = @tree_widget.getNodeById(id) - if node - selected_nodes.push(node) - - return selected_nodes - - getSelectedNodesUnder: (parent) -> - if @selected_single_node - if parent.isParentOf(@selected_single_node) - return [@selected_single_node] - else - return [] - else - selected_nodes = [] - - for id of @selected_nodes - node = @tree_widget.getNodeById(id) - if node and parent.isParentOf(node) - selected_nodes.push(node) - - return selected_nodes - - isNodeSelected: (node) -> - if not node - return false - else if node.id - if @selected_nodes[node.id] - return true - else - return false - else if @selected_single_node - return @selected_single_node.element == node.element - else - return false - - clear: -> - @selected_nodes = {} - @selected_single_node = null - - removeFromSelection: (node, include_children=false) -> - if not node.id - if @selected_single_node && node.element == @selected_single_node.element - @selected_single_node = null - else - delete @selected_nodes[node.id] - - if include_children - node.iterate( - (n) => - delete @selected_nodes[node.id] - return true - ) - - addToSelection: (node) -> - if node.id - @selected_nodes[node.id] = true - else - @selected_single_node = node - - -module.exports = SelectNodeHandler |