Source code for /src/LinkPane.js.txt
//======================================================================//
// Author: Mark Qian <markqian@hotmail.com> //
// WWW: http://www.coolshare.com //
// Copyright (c) 2006, Mark Qian //
// //
// You must contact Mark Qian to get a permission of use //
// in case you want to make any use of the codes except viewing it //
// on Mark's site. //
//======================================================================//
dojo.provide("dojo.widget.LinkPane");
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.ContentPane");
dojo.require("dojo.html.style");
dojo.widget.defineWidget(
"dojo.widget.LinkPane",
dojo.widget.ContentPane,
{
// summary
// LinkPane is just a ContentPane that loads data remotely (via the href attribute),
// and has markup similar to an anchor. The anchor's body (the words between <a> and </a>)
// become the label of the widget (used for TabContainer, AccordionContainer, etc.)
// usage
// <a href="foo.html">my label</a>
// I'm using a template because the user may specify the input as
// <a href="foo.html">label</a>, in which case we need to get rid of the
// <a> because we don't want a link.
templateString: '<div class="dojoLinkPane"></div>',
fillInTemplate: function(args, frag){
var source = this.getFragNodeRef(frag);
// If user has specified node contents, they become the label
// (the link must be plain text)
this.label += source.innerHTML;
var source = this.getFragNodeRef(frag);
dojo.html.copyStyle(this.domNode, source);
}
});