/* * Guacamole - Clientless Remote Desktop * Copyright (C) 2010 Michael Jumper * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ var GuacUI = GuacUI || {}; /** * Creates a new element having the given tagname and CSS class. */ GuacUI.createElement = function(tagname, classname) { var new_element = document.createElement(tagname); new_element.className = classname; return new_element; }; GuacUI.createChildElement = function(parent, tagname, classname) { var element = GuacUI.createElement(tagname, classname); parent.appendChild(element); return element; }; /** * Central registry of all components for all states. */ GuacUI.StateManager = new (function() { /** * The current state. */ var current_state = null; /** * Array of arrays of components, indexed by the states they are in. */ var components = []; /** * Registers the given component with this state manager, to be shown * during the given states. * * @param {GuacUI.Component} component The component to register. * @param {Number} [...] The list of states this component should be * visible during. */ this.registerComponent = function(component) { // For each state specified, add the given component for (var i=1; i