Subversion Repositories Applications.papyrus

Rev

Rev 1372 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1372 Rev 1422
1
/*
1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
3
	All Rights Reserved.
4
 
4
 
5
	Licensed under the Academic Free License version 2.1 or above OR the
5
	Licensed under the Academic Free License version 2.1 or above OR the
6
	modified BSD license. For more information on Dojo licensing, see:
6
	modified BSD license. For more information on Dojo licensing, see:
7
 
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
9
*/
-
 
10
 
-
 
11
 
10
 
12
 
11
dojo.provide("dojo.widget.HtmlWidget");
13
dojo.provide("dojo.widget.HtmlWidget");
12
dojo.require("dojo.widget.DomWidget");
14
dojo.require("dojo.widget.DomWidget");
13
dojo.require("dojo.html.util");
15
dojo.require("dojo.html.util");
14
dojo.require("dojo.html.display");
16
dojo.require("dojo.html.display");
15
dojo.require("dojo.html.layout");
17
dojo.require("dojo.html.layout");
16
dojo.require("dojo.lang.extras");
18
dojo.require("dojo.lang.extras");
17
dojo.require("dojo.lang.func");
19
dojo.require("dojo.lang.func");
18
dojo.require("dojo.lfx.toggle");
20
dojo.require("dojo.lfx.toggle");
19
dojo.declare("dojo.widget.HtmlWidget", dojo.widget.DomWidget, {templateCssPath:null, templatePath:null, lang:"", toggle:"plain", toggleDuration:150, initialize:function (args, frag) {
21
dojo.declare("dojo.widget.HtmlWidget", dojo.widget.DomWidget, {templateCssPath:null, templatePath:null, lang:"", toggle:"plain", toggleDuration:150, initialize:function (args, frag) {
20
}, postMixInProperties:function (args, frag) {
22
}, postMixInProperties:function (args, frag) {
21
	if (this.lang === "") {
23
	if (this.lang === "") {
22
		this.lang = null;
24
		this.lang = null;
23
	}
25
	}
24
	this.toggleObj = dojo.lfx.toggle[this.toggle.toLowerCase()] || dojo.lfx.toggle.plain;
26
	this.toggleObj = dojo.lfx.toggle[this.toggle.toLowerCase()] || dojo.lfx.toggle.plain;
25
}, createNodesFromText:function (txt, wrap) {
27
}, createNodesFromText:function (txt, wrap) {
26
	return dojo.html.createNodesFromText(txt, wrap);
28
	return dojo.html.createNodesFromText(txt, wrap);
27
}, destroyRendering:function (finalize) {
29
}, destroyRendering:function (finalize) {
28
	try {
30
	try {
29
		if (this.bgIframe) {
31
		if (this.bgIframe) {
30
			this.bgIframe.remove();
32
			this.bgIframe.remove();
31
			delete this.bgIframe;
33
			delete this.bgIframe;
32
		}
34
		}
33
		if (!finalize && this.domNode) {
35
		if (!finalize && this.domNode) {
34
			dojo.event.browser.clean(this.domNode);
36
			dojo.event.browser.clean(this.domNode);
35
		}
37
		}
36
		dojo.widget.HtmlWidget.superclass.destroyRendering.call(this);
38
		dojo.widget.HtmlWidget.superclass.destroyRendering.call(this);
37
	}
39
	}
38
	catch (e) {
40
	catch (e) {
39
	}
41
	}
40
}, isShowing:function () {
42
}, isShowing:function () {
41
	return dojo.html.isShowing(this.domNode);
43
	return dojo.html.isShowing(this.domNode);
42
}, toggleShowing:function () {
44
}, toggleShowing:function () {
43
	if (this.isShowing()) {
45
	if (this.isShowing()) {
44
		this.hide();
46
		this.hide();
45
	} else {
47
	} else {
46
		this.show();
48
		this.show();
47
	}
49
	}
48
}, show:function () {
50
}, show:function () {
49
	if (this.isShowing()) {
51
	if (this.isShowing()) {
50
		return;
52
		return;
51
	}
53
	}
52
	this.animationInProgress = true;
54
	this.animationInProgress = true;
53
	this.toggleObj.show(this.domNode, this.toggleDuration, null, dojo.lang.hitch(this, this.onShow), this.explodeSrc);
55
	this.toggleObj.show(this.domNode, this.toggleDuration, null, dojo.lang.hitch(this, this.onShow), this.explodeSrc);
54
}, onShow:function () {
56
}, onShow:function () {
55
	this.animationInProgress = false;
57
	this.animationInProgress = false;
56
	this.checkSize();
58
	this.checkSize();
57
}, hide:function () {
59
}, hide:function () {
58
	if (!this.isShowing()) {
60
	if (!this.isShowing()) {
59
		return;
61
		return;
60
	}
62
	}
61
	this.animationInProgress = true;
63
	this.animationInProgress = true;
62
	this.toggleObj.hide(this.domNode, this.toggleDuration, null, dojo.lang.hitch(this, this.onHide), this.explodeSrc);
64
	this.toggleObj.hide(this.domNode, this.toggleDuration, null, dojo.lang.hitch(this, this.onHide), this.explodeSrc);
63
}, onHide:function () {
65
}, onHide:function () {
64
	this.animationInProgress = false;
66
	this.animationInProgress = false;
65
}, _isResized:function (w, h) {
67
}, _isResized:function (w, h) {
66
	if (!this.isShowing()) {
68
	if (!this.isShowing()) {
67
		return false;
69
		return false;
68
	}
70
	}
69
	var wh = dojo.html.getMarginBox(this.domNode);
71
	var wh = dojo.html.getMarginBox(this.domNode);
70
	var width = w || wh.width;
72
	var width = w || wh.width;
71
	var height = h || wh.height;
73
	var height = h || wh.height;
72
	if (this.width == width && this.height == height) {
74
	if (this.width == width && this.height == height) {
73
		return false;
75
		return false;
74
	}
76
	}
75
	this.width = width;
77
	this.width = width;
76
	this.height = height;
78
	this.height = height;
77
	return true;
79
	return true;
78
}, checkSize:function () {
80
}, checkSize:function () {
79
	if (!this._isResized()) {
81
	if (!this._isResized()) {
80
		return;
82
		return;
81
	}
83
	}
82
	this.onResized();
84
	this.onResized();
83
}, resizeTo:function (w, h) {
85
}, resizeTo:function (w, h) {
84
	dojo.html.setMarginBox(this.domNode, {width:w, height:h});
86
	dojo.html.setMarginBox(this.domNode, {width:w, height:h});
85
	if (this.isShowing()) {
87
	if (this.isShowing()) {
86
		this.onResized();
88
		this.onResized();
87
	}
89
	}
88
}, resizeSoon:function () {
90
}, resizeSoon:function () {
89
	if (this.isShowing()) {
91
	if (this.isShowing()) {
90
		dojo.lang.setTimeout(this, this.onResized, 0);
92
		dojo.lang.setTimeout(this, this.onResized, 0);
91
	}
93
	}
92
}, onResized:function () {
94
}, onResized:function () {
93
	dojo.lang.forEach(this.children, function (child) {
95
	dojo.lang.forEach(this.children, function (child) {
94
		if (child.checkSize) {
96
		if (child.checkSize) {
95
			child.checkSize();
97
			child.checkSize();
96
		}
98
		}
97
	});
99
	});
98
}});
100
}});
99
 
101