1
|
<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
|
2
|
<html>
|
3
|
<head>
|
4
|
<title>
|
5
|
<a href='http://mapbuilder.sourceforge.net'>Community Map Builder</a> 27 Apr 2008 Overview
|
6
|
</title>
|
7
|
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
8
|
<script>
|
9
|
function asd() {
|
10
|
|
11
|
parent.document.title="Loading2.js Overview";
|
12
|
|
13
|
}
|
14
|
</script>
|
15
|
</head>
|
16
|
<body bgcolor="white" onload="asd();">
|
17
|
|
18
|
<!-- ========== START OF NAVBAR ========== -->
|
19
|
<a name="navbar_top"><!-- --></a>
|
20
|
<table border="0" width="100%" cellpadding="1" cellspacing="0">
|
21
|
<tr>
|
22
|
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
|
23
|
<a name="navbar_top_firstrow"><!-- --></a>
|
24
|
<table border="0" cellpadding="0" cellspacing="3">
|
25
|
<tr align="center" valign="top">
|
26
|
|
27
|
|
28
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td>
|
29
|
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td>
|
30
|
|
31
|
|
32
|
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td>
|
33
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td>
|
34
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td>
|
35
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td>
|
36
|
</tr>
|
37
|
</table>
|
38
|
</td>
|
39
|
<td bgcolor="#EEEEFF" align="right" valign="top">
|
40
|
<em>
|
41
|
<b><a href='http://mapbuilder.sourceforge.net'>Community Map Builder</a> 27 Apr 2008</b></em>
|
42
|
</td>
|
43
|
</tr>
|
44
|
|
45
|
<tr>
|
46
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
47
|
PREV
|
48
|
NEXT</font></td>
|
49
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
50
|
<a href="index.html" target="_top"><b>FRAMES</b></a>
|
51
|
<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
|
52
|
|
53
|
<script>
|
54
|
<!--
|
55
|
if(window==top) {
|
56
|
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
|
57
|
}
|
58
|
//-->
|
59
|
</script>
|
60
|
<noscript>
|
61
|
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
|
62
|
</noscript>
|
63
|
</font></td>
|
64
|
</tr>
|
65
|
</table>
|
66
|
<!-- =========== END OF NAVBAR =========== -->
|
67
|
|
68
|
<hr>
|
69
|
<center>
|
70
|
|
71
|
<h2>Loading2.js</h2>
|
72
|
|
73
|
</center>
|
74
|
|
75
|
|
76
|
|
77
|
|
78
|
<h4>Summary</h4>
|
79
|
<p>
|
80
|
|
81
|
No overview generated for 'Loading2.js'<BR/><BR/>
|
82
|
|
83
|
</p>
|
84
|
|
85
|
<hr>
|
86
|
|
87
|
|
88
|
<table border="1" cellpadding="3" cellspacing="0" width="100%">
|
89
|
<tr bgcolor="#CCCCFF" class="TableHeadingColor">
|
90
|
<td colspan=2><font size="+2">
|
91
|
|
92
|
<b>Class Summary</b>
|
93
|
|
94
|
</font></td>
|
95
|
</tr>
|
96
|
|
97
|
<tr bgcolor="white" class="TableRowColor">
|
98
|
<td width="15%"><b><a href="Loading2.html">Loading2</a></b></td>
|
99
|
<td> </td>
|
100
|
</tr>
|
101
|
|
102
|
</table>
|
103
|
<hr/>
|
104
|
|
105
|
|
106
|
<!-- ========== METHOD SUMMARY =========== -->
|
107
|
|
108
|
<!-- ========== END METHOD SUMMARY =========== -->
|
109
|
|
110
|
|
111
|
<pre class="sourceview"><span class="comment">/*
|
112
|
License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
|
113
|
$Id: Loading2.js 3879 2008-02-27 14:20:29Z gjvoosten $
|
114
|
*/</span>
|
115
|
<span class="comment">
|
116
|
// Ensure this object's dependancies are loaded.</span>
|
117
|
mapbuilder.loadScript(baseDir+<span class="literal">"/widget/WidgetBase.js"</span>);
|
118
|
|
119
|
<span class="comment">/**
|
120
|
* This widget is used to display ModelStatus messages. This widget is used
|
121
|
* like any other except that it is clreaed on the loadModel event and painted
|
122
|
* on the "newModel" and "modelStatus" events.
|
123
|
* Optional config parameters are an image source (usually an animated GIF) in
|
124
|
* the imageSource property, an optional static text message to be displayed as
|
125
|
* the textMessage property and if the widget is to be displayed over top of a
|
126
|
* map you can also specify the mapContainerId property.
|
127
|
* Dynamic message can be displayed by listening on the "modelStatus" event which
|
128
|
* sends a message as the parameter. Send a null message param to clear the widget.
|
129
|
* <span class="attrib">@constructor</span>
|
130
|
* <span class="attrib">@base</span> WidgetBase
|
131
|
* <span class="attrib">@author</span> Mike Adair
|
132
|
* <span class="attrib">@param</span> widgetNode The widget's XML object node from the configuration document.
|
133
|
* <span class="attrib">@param</span> model The model object that this widget belongs to.
|
134
|
*/</span>
|
135
|
<span class="reserved">function</span> Loading2(widgetNode, model) {
|
136
|
WidgetBase.apply(<span class="reserved">this</span>,new Array(widgetNode, model));
|
137
|
<span class="comment">
|
138
|
//loading img to be displayed while models load</span>
|
139
|
<span class="reserved">this</span>.imageSrc = config.skinDir + <span class="reserved">this</span>.getProperty(<span class="literal">"mb:imageSrc"</span>, <span class="literal">"/images/Loading.gif"</span>);
|
140
|
<span class="comment">
|
141
|
//a text message to be displayed while models load</span>
|
142
|
<span class="reserved">this</span>.textMessage = <span class="reserved">this</span>.getProperty(<span class="literal">"mb:textMessage"</span>, mbGetMessage(<span class="literal">"docLoading"</span>));
|
143
|
<span class="reserved">this</span>.updateMessage = <span class="reserved">this</span>.textMessage;
|
144
|
<span class="comment">
|
145
|
//check to see if this is to be put over a map if there isa mapContainerID supplied</span>
|
146
|
<span class="reserved">this</span>.mapContainerNode = widgetNode.selectSingleNode(<span class="literal">"mb:mapContainerId"</span>);
|
147
|
<span class="reserved">if</span> (!<span class="reserved">this</span>.mapContainerNode) {
|
148
|
<span class="reserved">this</span>.mapContainerNode = widgetNode.selectSingleNode(<span class="literal">"mb:targetModel"</span>);
|
149
|
}
|
150
|
<span class="reserved">if</span> (<span class="reserved">this</span>.mapContainerNode) {
|
151
|
<span class="reserved">this</span>.containerNodeId = getNodeValue(<span class="reserved">this</span>.mapContainerNode);
|
152
|
<span class="reserved">this</span>.htmlTagId = <span class="reserved">this</span>.containerNodeId;
|
153
|
}
|
154
|
<span class="comment">
|
155
|
//paint it on the "newModel" event, clear it on "loadModel" event</span>
|
156
|
<span class="reserved">this</span>.model.addListener(<span class="literal">"newModel"</span>,<span class="reserved">this</span>.paint, <span class="reserved">this</span>);
|
157
|
<span class="reserved">this</span>.model.addListener(<span class="literal">"loadModel"</span>,<span class="reserved">this</span>.clear, <span class="reserved">this</span>);
|
158
|
<span class="reserved">this</span>.model.addListener(<span class="literal">"refresh"</span>,<span class="reserved">this</span>.paint, <span class="reserved">this</span>);
|
159
|
<span class="reserved">this</span>.model.addListener(<span class="literal">"modelStatus"</span>,<span class="reserved">this</span>.update, <span class="reserved">this</span>);
|
160
|
}
|
161
|
|
162
|
<span class="comment">/**
|
163
|
* Render the widget.
|
164
|
* <span class="attrib">@param</span> objRef Pointer to widget object.
|
165
|
*/</span>
|
166
|
Loading2.<span class="reserved">prototype</span>.paint = <span class="reserved">function</span>(objRef) {
|
167
|
var node = objRef.getNode();
|
168
|
<span class="reserved">if</span> (node) {
|
169
|
<span class="comment"> //if it is a template model, no loader should be shown in the output div</span>
|
170
|
<span class="reserved">if</span> (objRef.model.template) <span class="reserved">return</span>;
|
171
|
<span class="comment"> //if there's no url, there will never be an update on the ModelStatus, so the image stays while nothing is happening.</span>
|
172
|
<span class="reserved">if</span> (!objRef.model.url && !objRef.mapContainerNode) <span class="reserved">return</span>;
|
173
|
<span class="comment"> //create the output node the first time this is called</span>
|
174
|
var outputNode = document.getElementById( objRef.outputNodeId+<span class="literal">"_loading"</span> );
|
175
|
<span class="reserved">if</span> (!outputNode) {
|
176
|
outputNode = document.createElement(<span class="literal">"div"</span>);
|
177
|
outputNode.setAttribute(<span class="literal">"id"</span>,objRef.outputNodeId+<span class="literal">"_loading"</span>);
|
178
|
node.appendChild(outputNode);
|
179
|
}
|
180
|
outputNode.className = <span class="literal">"loadingIndicator"</span>;
|
181
|
outputNode.style.zIndex = 10001;
|
182
|
<span class="comment"> //In a mapcontainer you want the loader in the left top, in other widgets embedded in the output area</span>
|
183
|
<span class="reserved">if</span> (objRef.mapContainerNode){
|
184
|
outputNode.style.position=<span class="literal">"absolute"</span>;
|
185
|
outputNode.style.left=<span class="literal">'0px'</span>;
|
186
|
outputNode.style.top=<span class="literal">'0px'</span>;
|
187
|
}
|
188
|
<span class="reserved">if</span> (objRef.imageSrc) {
|
189
|
var imageNode = document.getElementById( objRef.outputNodeId+<span class="literal">"_imageNode"</span> );
|
190
|
<span class="reserved">if</span> (!imageNode) {
|
191
|
imageNode = document.createElement(<span class="literal">"img"</span>);
|
192
|
imageNode.setAttribute(<span class="literal">"id"</span>,objRef.outputNodeId+<span class="literal">"_imageNode"</span>);
|
193
|
outputNode.appendChild(imageNode);
|
194
|
imageNode.style.zIndex = 10001;
|
195
|
}
|
196
|
imageNode.src = objRef.imageSrc;
|
197
|
}
|
198
|
<span class="reserved">if</span> (objRef.updateMessage) {
|
199
|
var messageNode = document.getElementById( objRef.outputNodeId+<span class="literal">"_messageNode"</span> );
|
200
|
<span class="reserved">if</span> (!messageNode) {
|
201
|
messageNode = document.createElement(<span class="literal">"p"</span>);
|
202
|
messageNode.setAttribute(<span class="literal">"id"</span>,objRef.outputNodeId+<span class="literal">"_messageNode"</span>);
|
203
|
outputNode.appendChild(messageNode);
|
204
|
}
|
205
|
messageNode.innerHTML = objRef.updateMessage;
|
206
|
}
|
207
|
}
|
208
|
}
|
209
|
|
210
|
<span class="comment">/**
|
211
|
* Remove the contents of the HTML tag for this widget.
|
212
|
* <span class="attrib">@param</span> objRef Reference to this object.
|
213
|
*/</span>
|
214
|
Loading2.<span class="reserved">prototype</span>.clear= <span class="reserved">function</span>(objRef, message) {
|
215
|
var outputNode = document.getElementById( objRef.outputNodeId+<span class="literal">"_loading"</span> );
|
216
|
var node = objRef.getNode();
|
217
|
<span class="reserved">if</span> (node && outputNode) node.removeChild(outputNode);
|
218
|
}
|
219
|
|
220
|
<span class="comment">/**
|
221
|
* Updates the loading indicator with a new message as a "updateStatus" listener.
|
222
|
* Send an null message to clear the loading indicator.
|
223
|
* <span class="attrib">@param</span> objRef Reference to this object.
|
224
|
*/</span>
|
225
|
Loading2.<span class="reserved">prototype</span>.update= <span class="reserved">function</span>(objRef, message) {
|
226
|
objRef.updateMessage = message || null;
|
227
|
<span class="reserved">if</span> (message) {
|
228
|
objRef.paint(objRef);
|
229
|
} <span class="reserved">else</span> {
|
230
|
objRef.clear(objRef);
|
231
|
}
|
232
|
}
|
233
|
|
234
|
</pre>
|
235
|
<hr>
|
236
|
|
237
|
|
238
|
|
239
|
<!-- ========== START OF NAVBAR ========== -->
|
240
|
<a name="navbar_top"><!-- --></a>
|
241
|
<table border="0" width="100%" cellpadding="1" cellspacing="0">
|
242
|
<tr>
|
243
|
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
|
244
|
<a name="navbar_top_firstrow"><!-- --></a>
|
245
|
<table border="0" cellpadding="0" cellspacing="3">
|
246
|
<tr align="center" valign="top">
|
247
|
|
248
|
|
249
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td>
|
250
|
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td>
|
251
|
|
252
|
|
253
|
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td>
|
254
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td>
|
255
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td>
|
256
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td>
|
257
|
</tr>
|
258
|
</table>
|
259
|
</td>
|
260
|
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
|
261
|
<b><a href='http://mapbuilder.sourceforge.net'>Community Map Builder</a> 27 Apr 2008</b></em>
|
262
|
</td>
|
263
|
</tr>
|
264
|
|
265
|
<tr>
|
266
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
267
|
PREV
|
268
|
NEXT</font></td>
|
269
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
270
|
<a href="index.html" target="_top"><b>FRAMES</b></a>
|
271
|
<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
|
272
|
|
273
|
<script>
|
274
|
<!--
|
275
|
if(window==top) {
|
276
|
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
|
277
|
}
|
278
|
//-->
|
279
|
</script>
|
280
|
<noscript>
|
281
|
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
|
282
|
</noscript>
|
283
|
</font></td>
|
284
|
</tr>
|
285
|
</table>
|
286
|
<!-- =========== END OF NAVBAR =========== -->
|
287
|
|
288
|
<hr>
|
289
|
<font size="-1">
|
290
|
|
291
|
</font>
|
292
|
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Sun Apr 27 20:30:54 2008</div>
|
293
|
</body>
|
294
|
</html>
|