/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */ /** * The default node presentation. The first parameter should be * either a string that will be used as the node's label, or an object * that has a string propery called label. By default, the clicking the * label will toggle the expanded/collapsed state of the node. By * changing the href property of the instance, this behavior can be * changed so that the label will go to the specified href. * * @extends YAHOO.widget.Node * @constructor * @param oData {object} a string or object containing the data that will * be used to render this node * @param oParent {YAHOO.widget.Node} this node's parent node * @param expanded {boolean} the initial expanded/collapsed state */ YAHOO.widget.TextNode = function(oData, oParent, expanded) { if (oParent) { this.init(oData, oParent, expanded); this.setUpLabel(oData); } }; YAHOO.widget.TextNode.prototype = new YAHOO.widget.Node(); /** * The CSS class for the label href. Defaults to ygtvlabel, but can be * overridden to provide a custom presentation for a specific node. * * @type string */ YAHOO.widget.TextNode.prototype.labelStyle = "ygtvlabel"; /** * The derived element id of the label for this node * * @type string */ YAHOO.widget.TextNode.prototype.labelElId = null; /** * The text for the label. It is assumed that the oData parameter will * either be a string that will be used as the label, or an object that * has a property called "label" that we will use. * * @type string */ YAHOO.widget.TextNode.prototype.label = null; /** * Sets up the node label * * @param oData string containing the label, or an object with a label property */ YAHOO.widget.TextNode.prototype.setUpLabel = function(oData) { if (typeof oData == "string") { oData = { label: oData }; } this.label = oData.label; // update the link if (oData.href) { this.href = oData.href; } // set the target if (oData.target) { this.target = oData.target; } this.labelElId = "ygtvlabelel" + this.index; }; /** * Returns the label element * * @return {object} the element */ YAHOO.widget.TextNode.prototype.getLabelEl = function() { return document.getElementById(this.labelElId); }; // overrides YAHOO.widget.Node YAHOO.widget.TextNode.prototype.getNodeHtml = function() { var sb = new Array(); sb[sb.length] = ''; sb[sb.length] = ''; for (i=0;i '; } var getNode = 'YAHOO.widget.TreeView.getNode(\'' + this.tree.id + '\',' + this.index + ')'; sb[sb.length] = ' '; sb[sb.length] = ''; sb[sb.length] = '
'; sb[sb.length] = '