Skip to main content
summaryrefslogtreecommitdiffstats
blob: 94cc1af5d9863efb8ed35f89db98831e358aba7f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
<%--
 Copyright (c) 2000, 2018 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials 
 are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html
 
 Contributors:
     IBM Corporation - initial API and implementation
--%>
<%@ include file="header.jsp"%>

<% 
	LayoutData data = new LayoutData(application,request, response);
	WebappPreferences prefs = data.getPrefs();
	AbstractView[] views = data.getViews();
%>

<html lang="<%=ServletResources.getString("locale", request)%>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title><%=ServletResources.getString("Tabs", request)%></title>
    
<style type="text/css">


BODY {
	margin:0px;
	padding:0px;
	height:100%;
<% 
if (data.isMozilla()){
%>
	height:21px;
<%
}
%>
}

a {
    cursor : default
}

/* tabs at the bottom */
.tab {
	font-size:5px;<%-- needed to verticaly center icon image --%>
	margin:0px;
	padding:0px;
	border-top:1px solid ThreeDShadow;
	border-bottom:1px solid <%=data.isMozilla()?prefs.getToolbarBackground():"ThreeDShadow"%>;
	cursor:default;
	background:<%=prefs.getToolbarBackground()%>;
}

.pressed {
	font-size:5px;<%-- needed to verticaly center icon image (on IE--%>
	margin:0px;
	padding:0px;
	cursor:default;
	<%=prefs.getViewBackgroundStyle()%>
	border-top:0px solid <%=prefs.getToolbarBackground()%>;
	border-bottom:1px solid ThreeDShadow;
}

.separator {
	height:100%;
	background-color:ThreeDShadow;
	border-bottom:1px solid <%=prefs.getToolbarBackground()%>;
}

.separator_pressed {
	height:100%;
	background-color:ThreeDShadow;
	border-top:0px solid <%=prefs.getToolbarBackground()%>;
	border-bottom:1px solid <%=prefs.getToolbarBackground()%>;
}

A {
	text-decoration:none;
	vertical-align:middle;
	height:16px;
	width:16px;
<% 
if (data.isIE()){
%>
	writing-mode:tb-rl; <%-- needed to verticaly center icon image on IE--%>
<%
} else {
%>
	display:block;<%-- needed to verticaly center icon image (remove extra pixels below) on Mozilla--%>
<%
}
%>
}

IMG {
	border:0px;
	margin:0px;
	padding:0px;
	height:16px;
	width:16px;
}

</style>
 
<script type="text/javascript">

var isMozilla = navigator.userAgent.indexOf('Mozilla') != -1 && parseInt(navigator.appVersion.substring(0,1)) >= 5;
var isIE = navigator.userAgent.indexOf('MSIE') != -1;
var linksArray = new Array ("linktoc", "linkindex", "linksearch", "linkbookmarks");

if (isIE){
  document.onkeydown = keyDownHandler;
} else {
  document.addEventListener('keydown', keyDownHandler, true);
}

/**
 * Returns the target node of an event
 */
function getTarget(e) {
	var target;
  	if (isIE)
   		target = window.event.srcElement;
  	else
  		target = e.target;

	return target;
}

<%
for (int i=0; i<views.length; i++) {
    if (views[i].isVisible()) {
%>
	var <%=views[i].getName()%> = new Image();
	<%=views[i].getName()%>.src = "<%=data.getImageURL(views[i])%>";
<%
    }
}
%>

var lastTab = "";
/* 
 * Switch tabs.
 */ 
function showTab(tab)
{ 	
	if (tab == lastTab) 
		return;
	
	lastTab = tab;
	
 	// show the appropriate pressed tab
  	var buttons = document.body.getElementsByTagName("TD");
  	for (var i=0; i<buttons.length; i++)
  	{
  		if (buttons[i].id == tab) { 
			buttons[i].className = "pressed";
			if (i > 0) 
				buttons[i-1].className = "separator_pressed";
			if (i<buttons.length-1) 
				buttons[i+1].className = "separator_pressed";
		} else if (buttons[i].className == "pressed") {
			buttons[i].className = "tab";
			if (i > 0) 
				if (i > 1 && buttons[i-2].id == tab) 
					buttons[i-1].className = "separator_pressed";
				else
					buttons[i-1].className = "separator";
			if (i<buttons.length-1) 
				if (i<buttons.length-2 && buttons[i+2].id == tab) 
					buttons[i+1].className = "separator_pressed";
				else
					buttons[i+1].className = "separator";
		}
 	 }
}

/**
 * Handler for key down (arrows)
 */
function keyDownHandler(e)
{
	var key;

	if (isIE) {
		key = window.event.keyCode;
	} else {
		key = e.keyCode;
	}
		
	if (key <37 || key > 39) 
		return true;
	
  	var clickedNode = getTarget(e);
  	if (!clickedNode) return true;

	var linkId="";
	if (clickedNode.tagName == 'A')
		linkId=clickedNode.id;
	else if(clickedNode.tagName == 'TD')
		linkId="link"+clickedNode.id;

  	if (isIE)
  		window.event.cancelBubble = true;
  	else
  		e.cancelBubble = true;
  	if (key == 38 ) { // up arrow
		if(linkId.length>4){
			parent.showView(linkId.substring(4, linkId.length));
			clickedNode.blur();
			parent.frames.ViewsFrame.focus();
		}
  	} else if (key == 39) { // Right arrow, expand
  		var nextLink=getNextLink(linkId);
		if(nextLink!=null){
			document.getElementById(nextLink).focus();
		}
  	} else if (key == 37) { // Left arrow,collapse
   		var previousLink=getPreviousLink(linkId);
		if(previousLink!=null){
			document.getElementById(previousLink).focus();
		}
 	}
  	 			
  	return false;
}

function getNextLink(currentLink){
	for(i=0; i<linksArray.length; i++){
		if(currentLink==linksArray[i]){
			if((i+1)<linksArray.length)
				return linksArray[i+1];
		}
	}
	return linksArray[0];
}

function getPreviousLink(currentLink){
	for(i=0; i<linksArray.length; i++){
		if(currentLink==linksArray[i]){
			if(i>0)
				 return linksArray[i-1];
		}
	}
	return linksArray[linksArray.length-1];
}

</script>

</head>
   
<body dir="<%=direction%>" onload="showTab('<%=data.getVisibleView()%>')">

  <table cellspacing="0" cellpadding="0" border="0" width="100%" height="100%" valign="middle">
   <tr>

<%
	for (int i=0; i<views.length; i++) 
	{
	    if (views[i].isVisible()) {
		    String title = data.getTitle(views[i]);
		    if (i != 0) {
%>
	<td width="1px" class="separator"><div style="width:1px;height:1px;display:block;"></div></td>
	<%-- div inside separator cell fixes top separator pixel that was not white on IE, or first separator not displayed when frame width happens to be even number of pixels --%>
<%
		    }
%>
	<td  title="<%=UrlUtil.htmlEncode(title)%>" 
	     align="center"  
	     valign="middle"
	     class="tab" 
	     id="<%=views[i].getName()%>" 
	     onclick="parent.showView('<%=views[i].getName()%>')" 
	     onmouseover="window.status='<%=UrlUtil.JavaScriptEncode(title)%>';return true;" 
	     onmouseout="window.status='';">
	     <a  href='javascript:parent.showView("<%=views[i].getName()%>");' 
	         onclick='this.blur();return false;' 
	         onmouseover="window.status='<%=UrlUtil.JavaScriptEncode(title)%>';return true;" 
	         onmouseout="window.status='';"
	         id="link<%=views[i].getName()%>"
	         <%=views[i].getKey()==View.NO_SHORTCUT?"":"ACCESSKEY=\""+views[i].getKey()+"\""%>>
	         <img alt="<%=UrlUtil.htmlEncode(title)%>" 
	              title="<%=UrlUtil.htmlEncode(title)%>" 
	              src="<%=data.getImageURL(views[i])%>"
	              id="img<%=views[i].getName()%>"
	              height="16"
	         >
	     </a>
	</td>
<%
        }
	}
%>
 
   </tr>
   </table>

</body>
</html>

Back to the top