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="TabbedContent.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>TabbedContent.js</h2>
|
72
|
|
73
|
</center>
|
74
|
|
75
|
|
76
|
|
77
|
|
78
|
<h4>Summary</h4>
|
79
|
<p>
|
80
|
|
81
|
No overview generated for 'TabbedContent.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="TabbedContent.html">TabbedContent</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
|
Author: Mike Adair/Fedele Stella
|
113
|
License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
|
114
|
|
115
|
$Id: TabbedContent.js 3879 2008-02-27 14:20:29Z gjvoosten $
|
116
|
*/</span>
|
117
|
<span class="comment">
|
118
|
// Ensure this object's dependancies are loaded.</span>
|
119
|
mapbuilder.loadScript(baseDir+<span class="literal">"/widget/WidgetBaseXSL.js"</span>);
|
120
|
|
121
|
<span class="comment">/**
|
122
|
* Widget to display various other widgets by selecting a tab in a tab bar.
|
123
|
*
|
124
|
* <span class="attrib">@constructor</span>
|
125
|
* <span class="attrib">@base</span> WidgetBaseXSL
|
126
|
* <span class="attrib">@param</span> widgetNode This widget's object node from the configuration document.
|
127
|
* <span class="attrib">@param</span> model The model that this widget is a view of.
|
128
|
*/</span>
|
129
|
|
130
|
<span class="reserved">function</span> TabbedContent(widgetNode, model) {
|
131
|
WidgetBaseXSL.apply(<span class="reserved">this</span>,new Array(widgetNode, model));
|
132
|
|
133
|
<span class="reserved">this</span>.selectedTab = null;
|
134
|
<span class="reserved">this</span>.tabList = new Array();
|
135
|
<span class="reserved">this</span>.textNodeXpath = <span class="literal">"/mb:WidgetText/mb:widgets/mb:TabbedContent"</span>;
|
136
|
|
137
|
<span class="comment">/**
|
138
|
* Initializes the tab list and sets the label for each tab
|
139
|
* <span class="attrib">@param</span> objRef a pointer to this object
|
140
|
*/</span>
|
141
|
<span class="reserved">this</span>.initTabs = <span class="reserved">function</span>(objRef) {
|
142
|
var tabs = objRef.widgetNode.selectNodes(<span class="literal">"mb:tab"</span>);
|
143
|
<span class="reserved">for</span> (var i=0; i<tabs.length; ++i) {
|
144
|
var tab = tabs[i];
|
145
|
var tabWidgetId = getNodeValue(tab);
|
146
|
var tabWidget = config.objects[tabWidgetId];
|
147
|
<span class="reserved">if</span> (!tabWidget) {
|
148
|
alert(mbGetMessage(<span class="literal">"tabWidgetNotFound"</span>, tabWidgetId));
|
149
|
<span class="reserved">return</span>;
|
150
|
}
|
151
|
|
152
|
objRef.tabList.push(tabWidget);
|
153
|
|
154
|
var tabLabel = tab.getAttribute(<span class="literal">"label"</span>);
|
155
|
<span class="reserved">if</span> (!tabLabel) tabLabel = tabWidgetId;
|
156
|
var textNode = config.widgetText.selectSingleNode(objRef.textNodeXpath+<span class="literal">"/mb:"</span>+tabWidgetId);
|
157
|
<span class="reserved">if</span> (textNode) tabLabel = getNodeValue(textNode);
|
158
|
tab.setAttribute(<span class="literal">"label"</span>,tabLabel);
|
159
|
|
160
|
tabWidget.model.addListener(<span class="literal">"refresh"</span>,objRef.paint,objRef);
|
161
|
tabWidget.model.addListener(<span class="literal">"refresh"</span>,objRef.selectTab,tabWidget);
|
162
|
}
|
163
|
}
|
164
|
<span class="reserved">this</span>.model.addListener(<span class="literal">"init"</span>,<span class="reserved">this</span>.initTabs,<span class="reserved">this</span>);
|
165
|
|
166
|
<span class="comment">/**
|
167
|
* Adds a widget to the list of tabs (TBD: not yet working/tested)
|
168
|
* <span class="attrib">@param</span> widget the widget to be added to the list of tabs
|
169
|
* <span class="attrib">@param</span> order the order within the tabs
|
170
|
*/</span>
|
171
|
<span class="reserved">this</span>.addWidget = <span class="reserved">function</span>(tabWidget,tabLabel) {
|
172
|
<span class="reserved">this</span>.tabList.push(tabWidget);
|
173
|
|
174
|
<span class="reserved">if</span> (!tabLabel) tabLabel = tabWidget.id;
|
175
|
var textNode = config.widgetText.selectSingleNode(<span class="reserved">this</span>.textNodeXpath+<span class="literal">"/mb:"</span>+tabWidget.id);
|
176
|
<span class="reserved">if</span> (textNode) tabLabel = getNodeValue(textNode);
|
177
|
|
178
|
var tabNode = <span class="reserved">this</span>.model.doc.createElementNS(mbNS,<span class="literal">"tab"</span>);
|
179
|
tabNode.appendChild(<span class="reserved">this</span>.model.doc.createTextNode(tabWidget.id));
|
180
|
tabNode.setAttribute(<span class="literal">"label"</span>,tabLabel);
|
181
|
<span class="reserved">this</span>.widgetNode.appendChild(tabNode);
|
182
|
|
183
|
<span class="reserved">this</span>.paint(<span class="reserved">this</span>);
|
184
|
<span class="reserved">this</span>.selectTab(tabWidget);
|
185
|
}
|
186
|
|
187
|
<span class="comment">/**
|
188
|
* Selects a tab, which has the effect of displaying that widget in the
|
189
|
* workspace
|
190
|
* <span class="attrib">@param</span> tabWidget the widget to be selected
|
191
|
*/</span>
|
192
|
<span class="reserved">this</span>.selectTab = <span class="reserved">function</span>(tabWidget) {
|
193
|
<span class="reserved">if</span> (!tabWidget.model.doc) {
|
194
|
alert(mbGetMessage(<span class="literal">"noDataYet"</span>));
|
195
|
<span class="reserved">return</span>;
|
196
|
}
|
197
|
var tabBar = config.objects[tabWidget.tabBarId]
|
198
|
<span class="reserved">if</span> (tabBar.selectedTab!=null) tabBar.selectedTab.className = <span class="literal">''</span>;
|
199
|
var newAnchor = document.getElementById(tabBar.id+<span class="literal">"_"</span>+tabWidget.id);
|
200
|
<span class="reserved">if</span> (newAnchor) {
|
201
|
newAnchor.className = <span class="literal">'current'</span>;
|
202
|
tabBar.selectedTab = newAnchor;
|
203
|
tabWidget.paint(tabWidget,tabWidget.id);
|
204
|
}
|
205
|
<span class="reserved">if</span> (tabWidget.tabAction) eval(tabWidget.tabAction);
|
206
|
}
|
207
|
|
208
|
<span class="comment">/**
|
209
|
* sett the doc to be styled to the TabbedContent node from config
|
210
|
* <span class="attrib">@param</span> objRef a pointer to this object
|
211
|
*/</span>
|
212
|
<span class="reserved">this</span>.prePaint = <span class="reserved">function</span>(objRef){
|
213
|
objRef.resultDoc = objRef.widgetNode;
|
214
|
<span class="reserved">for</span> (var i=0; i<objRef.tabList.length; ++i) {
|
215
|
var tabWidget = objRef.tabList[i];
|
216
|
tabWidget.tabBarId = <span class="reserved">this</span>.id;
|
217
|
var tabNode = objRef.resultDoc.selectSingleNode(<span class="literal">"mb:tab[text()='"</span>+tabWidget.id+<span class="literal">"']"</span>);
|
218
|
<span class="reserved">if</span> (!tabWidget.model.doc) {
|
219
|
tabNode.setAttribute(<span class="literal">"disabled"</span>, <span class="literal">"true"</span>);
|
220
|
} <span class="reserved">else</span> {
|
221
|
tabNode.removeAttribute(<span class="literal">"disabled"</span>);
|
222
|
}
|
223
|
<span class="comment">
|
224
|
//specify an optional action to be performed when the tab is selected</span>
|
225
|
<span class="reserved">this</span>.tabAction = <span class="reserved">this</span>.getProperty(<span class="literal">"mb:tabAction"</span>);
|
226
|
}
|
227
|
}
|
228
|
|
229
|
}
|
230
|
</pre>
|
231
|
<hr>
|
232
|
|
233
|
|
234
|
|
235
|
<!-- ========== START OF NAVBAR ========== -->
|
236
|
<a name="navbar_top"><!-- --></a>
|
237
|
<table border="0" width="100%" cellpadding="1" cellspacing="0">
|
238
|
<tr>
|
239
|
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
|
240
|
<a name="navbar_top_firstrow"><!-- --></a>
|
241
|
<table border="0" cellpadding="0" cellspacing="3">
|
242
|
<tr align="center" valign="top">
|
243
|
|
244
|
|
245
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td>
|
246
|
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td>
|
247
|
|
248
|
|
249
|
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td>
|
250
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td>
|
251
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td>
|
252
|
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td>
|
253
|
</tr>
|
254
|
</table>
|
255
|
</td>
|
256
|
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
|
257
|
<b><a href='http://mapbuilder.sourceforge.net'>Community Map Builder</a> 27 Apr 2008</b></em>
|
258
|
</td>
|
259
|
</tr>
|
260
|
|
261
|
<tr>
|
262
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
263
|
PREV
|
264
|
NEXT</font></td>
|
265
|
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
266
|
<a href="index.html" target="_top"><b>FRAMES</b></a>
|
267
|
<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
|
268
|
|
269
|
<script>
|
270
|
<!--
|
271
|
if(window==top) {
|
272
|
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
|
273
|
}
|
274
|
//-->
|
275
|
</script>
|
276
|
<noscript>
|
277
|
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
|
278
|
</noscript>
|
279
|
</font></td>
|
280
|
</tr>
|
281
|
</table>
|
282
|
<!-- =========== END OF NAVBAR =========== -->
|
283
|
|
284
|
<hr>
|
285
|
<font size="-1">
|
286
|
|
287
|
</font>
|
288
|
<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>
|
289
|
</body>
|
290
|
</html>
|