Skip to main content
summaryrefslogtreecommitdiffstats
blob: 8a010ae2aaab01faff384855483c467afaa590a9 (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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
/**
 * Copyright (c) 2009 Oracle 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:
 *    Oracle Corporation - initial API and implementation
 */
package org.eclipse.jst.jsf.apache.trinidad.tagsupport.converter.operations;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.jst.jsf.apache.trinidad.tagsupport.ITrinidadConstants;
import org.eclipse.jst.jsf.apache.trinidad.tagsupport.Messages;
import org.eclipse.jst.pagedesigner.converter.ConvertPosition;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

/**
 * ITransformOperation implementation specifically for the "navigationPane"
 * JSF Element.
 * 
 * <br><b>Note:</b> requires ITransformOperation.setTagConverterContext(...) to
 * have been called to provide a valid ITagConverterContext instance prior to
 * a call to the transform(...) method.
 * 
 * @author Ian Trimble - Oracle
 */
public class NavigationPaneOperation extends AbstractTrinidadTransformOperation {

	private static final String STYLECLASS_OUTERDIV = "af_navigationPane"; //$NON-NLS-1$

	private static final String STYLECLASS_BAR_OUTERDIV = "af_navigationPane_bar"; //$NON-NLS-1$
	private static final String STYLECLASS_BAR_TABLE_INACTIVE_ENABLED = "af_navigationPane_bar-inactive-enabled"; //$NON-NLS-1$
	private static final String STYLECLASS_BAR_TABLE_ACTIVE_ENABLED = "af_navigationPane_bar-active-enabled"; //$NON-NLS-1$
	private static final String STYLECLASS_BAR_TABLE_INACTIVE_DISABLED = "af_navigationPane_bar-inactive-disabled"; //$NON-NLS-1$
	private static final String STYLECLASS_BAR_TABLE_ACTIVE_DISABLED = "af_navigationPane_bar-active-disabled"; //$NON-NLS-1$
	private static final String STYLECLASS_BAR_DIV_CONTENT = "af_navigationPane_bar-content"; //$NON-NLS-1$
	private static final String STYLECLASS_BAR_DIV_SEPARATOR = "af_navigationPane_bar-separator"; //$NON-NLS-1$

	private static final String STYLECLASS_BUTTONS_TABLE_INACTIVE_ENABLED = "af_navigationPane_buttons-inactive-enabled"; //$NON-NLS-1$
	private static final String STYLECLASS_BUTTONS_TABLE_ACTIVE_ENABLED = "af_navigationPane_buttons-active-enabled"; //$NON-NLS-1$
	private static final String STYLECLASS_BUTTONS_TABLE_INACTIVE_DISABLED = "af_navigationPane_buttons-inactive-disabled"; //$NON-NLS-1$
	private static final String STYLECLASS_BUTTONS_TABLE_ACTIVE_DISABLED = "af_navigationPane_buttons-active-disabled"; //$NON-NLS-1$
	private static final String STYLECLASS_BUTTONS_DIV_CONTENT = "af_navigationPane_buttons-content"; //$NON-NLS-1$
	private static final String STYLECLASS_BUTTONS_DIV_SEPARATOR = "af_navigationPane_buttons-separator"; //$NON-NLS-1$

	private static final String STYLECLASS_CHOICE_SELECT = "af_navigationPane_choice-options"; //$NON-NLS-1$
	private static final String STYLECLASS_CHOICE_BUTTON = "af_navigationPane_choice-button"; //$NON-NLS-1$

	private static final String STYLECLASS_LIST_TABLE_INACTIVE_ENABLED = "af_navigationPane_list-inactive-enabled"; //$NON-NLS-1$
	private static final String STYLECLASS_LIST_TABLE_ACTIVE_ENABLED = "af_navigationPane_list-active-enabled"; //$NON-NLS-1$
	private static final String STYLECLASS_LIST_TABLE_INACTIVE_DISABLED = "af_navigationPane_list-inactive-disabled"; //$NON-NLS-1$
	private static final String STYLECLASS_LIST_TABLE_ACTIVE_DISABLED = "af_navigationPane_list-active-disabled"; //$NON-NLS-1$
	private static final String STYLECLASS_LIST_TD_BULLET = "af_navigationPane_list-bullet"; //$NON-NLS-1$
	private static final String STYLECLASS_LIST_DIV_CONTENT = "af_navigationPane_list-content"; //$NON-NLS-1$

	private static final String STYLECLASS_TABS_TABLE_INACTIVE_ENABLED = "af_navigationPane_tabs-inactive"; //$NON-NLS-1$
	private static final String STYLECLASS_TABS_TABLE_ACTIVE_ENABLED = "af_navigationPane_tabs-active"; //$NON-NLS-1$
	private static final String STYLECLASS_TABS_TABLE_INACTIVE_DISABLED = "af_navigationPane_tabs-inactive p_AFDisabled"; //$NON-NLS-1$
	private static final String STYLECLASS_TABS_TABLE_ACTIVE_DISABLED = "af_navigationPane_tabs-active p_AFDisabled"; //$NON-NLS-1$
	private static final String STYLECLASS_TABS_TD_START = "af_navigationPane_tabs-start"; //$NON-NLS-1$
	private static final String STYLECLASS_TABS_TD_START_JOIN = "af_navigationPane_tabs-start-join"; //$NON-NLS-1$
	private static final String STYLECLASS_TABS_TD_START_JOINFROMACTIVE = "af_navigationPane_tabs-start-join-from-active"; //$NON-NLS-1$
	private static final String STYLECLASS_TABS_TD_START_JOINFROMINACTIVE = "af_navigationPane_tabs-start-join-from-inactive"; //$NON-NLS-1$
	private static final String STYLECLASS_TABS_TD_BOTTOM_START = "af_navigationPane_tabs-bottom-start"; //$NON-NLS-1$
	private static final String STYLECLASS_TABS_TD_MID = "af_navigationPane_tabs-mid"; //$NON-NLS-1$
	private static final String STYLECLASS_TABS_TD_BOTTOM_MID = "af_navigationPane_tabs-bottom-mid"; //$NON-NLS-1$
	private static final String STYLECLASS_TABS_TD_END = "af_navigationPane_tabs-end"; //$NON-NLS-1$
	private static final String STYLECLASS_TABS_TD_END_JOINTOINACTIVE = "af_navigationPane_tabs-end-join-to-inactive"; //$NON-NLS-1$
	private static final String STYLECLASS_TABS_TD_BOTTOM_END = "af_navigationPane_tabs-bottom-end"; //$NON-NLS-1$
	private static final String STYLECLASS_TABS_TD_BOTTOM_END_JOIN = "af_navigationPane_tabs-bottom-end-join"; //$NON-NLS-1$
	private static final String STYLECLASS_TABS_DIV_BOTTOM_START_CONTENT = "af_navigationPane_tabs-bottom-start-content"; //$NON-NLS-1$
	private static final String STYLECLASS_TABS_DIV_BOTTOM_MID_CONTENT = "af_navigationPane_tabs-bottom-mid-content"; //$NON-NLS-1$
	private static final String STYLECLASS_TABS_DIV_BOTTOM_END_CONTENT = "af_navigationPane_tabs-bottom-end-content"; //$NON-NLS-1$
	

	/* (non-Javadoc)
	 * @see org.eclipse.jst.pagedesigner.dtmanager.converter.operations.AbstractTransformOperation#transform(org.w3c.dom.Element, org.w3c.dom.Element)
	 */
	@Override
	public Element transform(Element srcElement, Element curElement) {
		Element div = null;
		String hint = getHint(srcElement);
		if (hint.equalsIgnoreCase("bar")) { //$NON-NLS-1$
			div = transformAsBar(srcElement);
		} else if (hint.equalsIgnoreCase("buttons")) { //$NON-NLS-1$
			div = transformAsButtons(srcElement);
		} else if (hint.equalsIgnoreCase("choice")) { //$NON-NLS-1$
			div = transformAsChoice(srcElement);
		} else if (hint.equalsIgnoreCase("list")) { //$NON-NLS-1$
			div = transformAsList(srcElement);
		} else if (hint.equalsIgnoreCase("tabs")) { //$NON-NLS-1$
			div = transformAsTabs(srcElement);
		} else {
			div = transformAsBar(srcElement);
		}
		return div;
	}

	private Element transformAsBar(Element srcElement) {
		return transformAsBarOrButtons(srcElement, true);
	}

	private Element transformAsButtons(Element srcElement) {
		return transformAsBarOrButtons(srcElement, false);
	}

	private Element transformAsBarOrButtons(Element srcElement, boolean isBar) {
		Element div = null;
		String styleClass_outerDiv;
		String styleClass_tableInactiveEnabled;
		String styleClass_tableActiveEnabled;
		String styleClass_tableInactiveDisabled;
		String styleClass_tableActiveDisabled;
		String styleClass_divContent;
		String styleClass_divSeparator;
		if (isBar) {
			styleClass_outerDiv = STYLECLASS_BAR_OUTERDIV;
			styleClass_tableInactiveEnabled = STYLECLASS_BAR_TABLE_INACTIVE_ENABLED;
			styleClass_tableActiveEnabled = STYLECLASS_BAR_TABLE_ACTIVE_ENABLED;
			styleClass_tableInactiveDisabled = STYLECLASS_BAR_TABLE_INACTIVE_DISABLED;
			styleClass_tableActiveDisabled = STYLECLASS_BAR_TABLE_ACTIVE_DISABLED;
			styleClass_divContent = STYLECLASS_BAR_DIV_CONTENT;
			styleClass_divSeparator = STYLECLASS_BAR_DIV_SEPARATOR;
		} else {
			styleClass_outerDiv = STYLECLASS_OUTERDIV;
			styleClass_tableInactiveEnabled = STYLECLASS_BUTTONS_TABLE_INACTIVE_ENABLED;
			styleClass_tableActiveEnabled = STYLECLASS_BUTTONS_TABLE_ACTIVE_ENABLED;
			styleClass_tableInactiveDisabled = STYLECLASS_BUTTONS_TABLE_INACTIVE_DISABLED;
			styleClass_tableActiveDisabled = STYLECLASS_BUTTONS_TABLE_ACTIVE_DISABLED;
			styleClass_divContent = STYLECLASS_BUTTONS_DIV_CONTENT;
			styleClass_divSeparator = STYLECLASS_BUTTONS_DIV_SEPARATOR;
		}
		div = createElement("div"); //$NON-NLS-1$
		setClassAndStyleAttributes(srcElement, styleClass_outerDiv, div);
		List<Element> childCmdNavItems = getChildCmdNavItems(srcElement);
		int index = 0;
		int numChildCmdNavItems = childCmdNavItems.size();
		if (numChildCmdNavItems > 0) {
			for (Element childCmdNavItem: childCmdNavItems) {
				String styleClass =
					determineStyleClass(
							childCmdNavItem,
							styleClass_tableActiveEnabled,
							styleClass_tableActiveDisabled,
							styleClass_tableInactiveEnabled,
							styleClass_tableInactiveDisabled);
				Element tbody = appendTableAndTBody(div, true, styleClass);
				Element tr = appendChildElement("tr", tbody); //$NON-NLS-1$
				Element contentTD = appendChildElement("td", tr); //$NON-NLS-1$
				Element contentDiv = appendChildElement("div", contentTD); //$NON-NLS-1$
				appendAttribute(contentDiv, "class", styleClass_divContent); //$NON-NLS-1$
				tagConverterContext.addChild(
						childCmdNavItem,
						new ConvertPosition(contentDiv, 0));
				if (index++ < numChildCmdNavItems - 1) {
					Element separatorTD = appendChildElement("td", tr); //$NON-NLS-1$
					Element separatorDiv = appendChildElement("div", separatorTD); //$NON-NLS-1$
					appendAttribute(separatorDiv, "class", styleClass_divSeparator); //$NON-NLS-1$
					appendChildText("|", separatorDiv); //$NON-NLS-1$
				}
			}
		} else {
			setEmptyNavPaneMessage(div);
		}
		return div;
	}

	private Element transformAsChoice(Element srcElement) {
		Element div = null;
		div = createElement("div"); //$NON-NLS-1$
		setClassAndStyleAttributes(srcElement, STYLECLASS_OUTERDIV, div);
		List<Element> childCmdNavItems = getChildCmdNavItems(srcElement);
		if (childCmdNavItems.size() > 0) {
			Element select = appendChildElement("select", div); //$NON-NLS-1$
			appendAttribute(select, "class", STYLECLASS_CHOICE_SELECT); //$NON-NLS-1$
			for (Element childCmdNavItem: childCmdNavItems) {
				if (!CommandNavigationItemOperation.isDisabled(childCmdNavItem)) {
					Element option = appendChildElement("option", select); //$NON-NLS-1$
					if (CommandNavigationItemOperation.isSelected(childCmdNavItem)) {
						appendAttribute(option, "selected", "selected"); //$NON-NLS-1$ //$NON-NLS-2$
					}
					appendChildText(CommandNavigationItemOperation.getText(childCmdNavItem), option);
				}
			}
			Element span = appendChildElement("span", div); //$NON-NLS-1$
			appendAttribute(span, "style", "width: 5px;"); //$NON-NLS-1$ //$NON-NLS-2$
			appendChildText(" ", span); //$NON-NLS-1$
			Element button = appendChildElement("button", div); //$NON-NLS-1$
			appendAttribute(button, "class", STYLECLASS_CHOICE_BUTTON); //$NON-NLS-1$
			appendAttribute(button, "type", "button"); //$NON-NLS-1$ //$NON-NLS-2$
			appendChildText("Go", button); //$NON-NLS-1$
		} else {
			setEmptyNavPaneMessage(div);
		}
		return div;
	}

	private Element transformAsList(Element srcElement) {
		Element div = null;
		div = createElement("div"); //$NON-NLS-1$
		setClassAndStyleAttributes(srcElement, STYLECLASS_OUTERDIV, div);
		List<Element> childCmdNavItems = getChildCmdNavItems(srcElement);
		if (childCmdNavItems.size() > 0) {
			for (Element childCmdNavItem: childCmdNavItems) {
				String styleClass =
					determineStyleClass(
							childCmdNavItem,
							STYLECLASS_LIST_TABLE_ACTIVE_ENABLED,
							STYLECLASS_LIST_TABLE_ACTIVE_DISABLED,
							STYLECLASS_LIST_TABLE_INACTIVE_ENABLED,
							STYLECLASS_LIST_TABLE_INACTIVE_DISABLED);
				Element tbody = appendTableAndTBody(div, false, styleClass);
				Element tr = appendChildElement("tr", tbody); //$NON-NLS-1$
				Element bulletTD = appendChildElement("td", tr); //$NON-NLS-1$
				appendAttribute(bulletTD, "class", STYLECLASS_LIST_TD_BULLET); //$NON-NLS-1$
				Element bulletDiv = appendChildElement("div", bulletTD); //$NON-NLS-1$
				appendChildText(" ", bulletDiv); //$NON-NLS-1$
				Element contentTD = appendChildElement("td", tr); //$NON-NLS-1$
				Element contentDiv = appendChildElement("div", contentTD); //$NON-NLS-1$
				appendAttribute(contentDiv, "class", STYLECLASS_LIST_DIV_CONTENT); //$NON-NLS-1$
				tagConverterContext.addChild(
						childCmdNavItem,
						new ConvertPosition(contentDiv, 0));
			}
		} else {
			setEmptyNavPaneMessage(div);
		}
		return div;
	}

	private Element transformAsTabs(Element srcElement) {
		Element div = null;
		div = createElement("div"); //$NON-NLS-1$
		setClassAndStyleAttributes(srcElement, STYLECLASS_OUTERDIV, div);
		List<Element> childCmdNavItems = getChildCmdNavItems(srcElement);
		int index = 0;
		int numChildCmdNavItems = childCmdNavItems.size();
		int selectedTabIndex = determineSelectedTabIndex(childCmdNavItems);
		if (numChildCmdNavItems > 0) {
			for (Element childCmdNavItem: childCmdNavItems) {
				String tableStyleClass =
					determineStyleClass(
							childCmdNavItem,
							STYLECLASS_TABS_TABLE_ACTIVE_ENABLED,
							STYLECLASS_TABS_TABLE_ACTIVE_DISABLED,
							STYLECLASS_TABS_TABLE_INACTIVE_ENABLED,
							STYLECLASS_TABS_TABLE_INACTIVE_DISABLED);
				Element outerTBody = appendTableAndTBody(div, true, ""); //$NON-NLS-1$
				Element outerTR = appendChildElement("tr", outerTBody); //$NON-NLS-1$
				Element outerTD = appendChildElement("td", outerTR); //$NON-NLS-1$
				Element innerTBody = appendTableAndTBody(outerTD, false, tableStyleClass);
				appendStartColumn(innerTBody, index, selectedTabIndex);
				outerTD = appendChildElement("td", outerTR); //$NON-NLS-1$
				innerTBody = appendTableAndTBody(outerTD, false, tableStyleClass);
				appendMidColumn(innerTBody, childCmdNavItem);
				if (index + 1 != selectedTabIndex) {
					outerTD = appendChildElement("td", outerTR); //$NON-NLS-1$
					innerTBody = appendTableAndTBody(outerTD, false, tableStyleClass);
					appendEndColumn(innerTBody, index, numChildCmdNavItems);
				}
				index++;
			}
		} else {
			setEmptyNavPaneMessage(div);
		}
		return div;
	}

	private List<Element> getChildCmdNavItems(Element srcElement) {
		List<Element> childCmdNavItems = new ArrayList<Element>();
		NodeList childElements = srcElement.getElementsByTagNameNS(ITrinidadConstants.URI_CORE, "commandNavigationItem"); //$NON-NLS-1$$
		if (childElements != null && childElements.getLength() > 0) {
			for (int i = 0, len = childElements.getLength(); i < len; i++) {
				childCmdNavItems.add((Element)childElements.item(i));
			}
		} else {
			Element nodeStampFacet = getChildFacetByName(srcElement, "nodeStamp"); //$NON-NLS-1$
			if (nodeStampFacet != null) {
				childElements = nodeStampFacet.getElementsByTagNameNS(ITrinidadConstants.URI_CORE, "commandNavigationItem"); //$NON-NLS-1$
				if (childElements != null && childElements.getLength() > 0) {
					for (int i = 0, len = childElements.getLength(); i < len; i++) {
						childCmdNavItems.add((Element)childElements.item(i));
					}
				}
			}
		}
		return childCmdNavItems;
	}

	private String getHint(Element srcElement) {
		String hint = srcElement.getAttribute("hint"); //$NON-NLS-1$
		return hint != null ? hint : "bar"; //$NON-NLS-1$
	}

	private void setClassAndStyleAttributes(Element srcElement, String baseStyleClass, Element curElement) {
		String styleClass = calculateStyleClass(baseStyleClass, srcElement);
		if (styleClass != null) {
			appendAttribute(curElement, "class", styleClass); //$NON-NLS-1$
		}
		String style = srcElement.getAttribute("inlineStyle"); //$NON-NLS-1$
		if (style != null) {
			appendAttribute(curElement, "style", style); //$NON-NLS-1$
		}
	}

	private void setEmptyNavPaneMessage(Element curElement) {
		appendAttribute(curElement, "style", ITrinidadConstants.STYLE_EMPTYELEMENT); //$NON-NLS-1$
		appendChildText(Messages.NavigationPaneOperation_EmptyNavigationPaneTag, curElement);
	}

	private Element appendTableAndTBody(Element parentElement, boolean isInline, String styleClass) {
		Element table = appendChildElement("table", parentElement); //$NON-NLS-1$
		appendAttribute(table, "cellpadding", "0"); //$NON-NLS-1$ //$NON-NLS-2$
		appendAttribute(table, "cellspacing", "0"); //$NON-NLS-1$ //$NON-NLS-2$
		appendAttribute(table, "border", "0"); //$NON-NLS-1$ //$NON-NLS-2$
		if (isInline) {
			appendAttribute(table, "style", "display: inline;"); //$NON-NLS-1$ //$NON-NLS-2$
		}
		appendAttribute(table, "class", styleClass); //$NON-NLS-1$
		Element tbody = appendChildElement("tbody", table); //$NON-NLS-1$
		return tbody;
	}

	private String determineStyleClass(
			Element cmdNavItem,
			String styleClass_ActiveEnabled,
			String styleClass_ActiveDisabled,
			String styleClass_InactiveEnabled,
			String styleClass_InactiveDisabled) {
		String styleClass;
		if (CommandNavigationItemOperation.isSelected(cmdNavItem)) {
			if (!CommandNavigationItemOperation.isDisabled(cmdNavItem)) {
				styleClass = styleClass_ActiveEnabled;
			} else {
				styleClass = styleClass_ActiveDisabled;
			}
		} else {
			if (!CommandNavigationItemOperation.isDisabled(cmdNavItem)) {
				styleClass = styleClass_InactiveEnabled;
			} else {
				styleClass = styleClass_InactiveDisabled;
			}
		}
		return styleClass;
	}

	private int determineSelectedTabIndex(List<Element> childCmdNavItems) {
		int selectedTabIndex = -2;
		int curTabIndex = 0;
		for (Element childCmdNavItem: childCmdNavItems) {
			if (CommandNavigationItemOperation.isSelected(childCmdNavItem)) {
				selectedTabIndex = curTabIndex;
				break;
			}
			curTabIndex++;
		}
		return selectedTabIndex;
	}

	private void appendStartColumn(Element parentTBody, int curTabIndex, int selectedTabIndex) {
		String topTDStyleClass;
		String bottomTDStyleClass;
		String divStyleClass;
		if (curTabIndex == 0) {
			topTDStyleClass = STYLECLASS_TABS_TD_START;
			bottomTDStyleClass = STYLECLASS_TABS_TD_BOTTOM_START;
			divStyleClass = STYLECLASS_TABS_DIV_BOTTOM_START_CONTENT;
		} else {
			if (curTabIndex == selectedTabIndex) {
				topTDStyleClass = STYLECLASS_TABS_TD_START_JOIN;
				bottomTDStyleClass = STYLECLASS_TABS_TD_BOTTOM_START;
				divStyleClass = STYLECLASS_TABS_DIV_BOTTOM_START_CONTENT;
			} else {
				if (curTabIndex == selectedTabIndex + 1) {
					topTDStyleClass = STYLECLASS_TABS_TD_START_JOINFROMACTIVE;
				} else {
					topTDStyleClass = STYLECLASS_TABS_TD_START_JOINFROMINACTIVE;
				}
				bottomTDStyleClass = STYLECLASS_TABS_TD_BOTTOM_END;
				divStyleClass = STYLECLASS_TABS_DIV_BOTTOM_MID_CONTENT;
			}
		}
		Element topTR = appendChildElement("tr", parentTBody); //$NON-NLS-1$
		Element topTD = appendChildElement("td", topTR); //$NON-NLS-1$
		appendAttribute(topTD, "class", topTDStyleClass); //$NON-NLS-1$
		Element bottomTR = appendChildElement("tr", parentTBody); //$NON-NLS-1$
		Element bottomTD = appendChildElement("td", bottomTR); //$NON-NLS-1$
		appendAttribute(bottomTD, "class", bottomTDStyleClass); //$NON-NLS-1$
		Element div = appendChildElement("div", bottomTD); //$NON-NLS-1$
		appendAttribute(div, "class", divStyleClass); //$NON-NLS-1$
	}

	private void appendMidColumn(Element parentTBody, Element cmdNavItem) {
		Element topTR = appendChildElement("tr", parentTBody); //$NON-NLS-1$
		Element topTD = appendChildElement("td", topTR); //$NON-NLS-1$
		appendAttribute(topTD, "class", STYLECLASS_TABS_TD_MID); //$NON-NLS-1$
		tagConverterContext.addChild(cmdNavItem, new ConvertPosition(topTD, 0));
		Element bottomTR = appendChildElement("tr", parentTBody); //$NON-NLS-1$
		Element bottomTD = appendChildElement("td", bottomTR); //$NON-NLS-1$
		appendAttribute(bottomTD, "class", STYLECLASS_TABS_TD_BOTTOM_MID); //$NON-NLS-1$
		Element div = appendChildElement("div", bottomTD); //$NON-NLS-1$
		appendAttribute(div, "class", STYLECLASS_TABS_DIV_BOTTOM_MID_CONTENT); //$NON-NLS-1$
	}

	private void appendEndColumn(Element parentTBody, int curTabIndex, int numTabs) {
		String topTDStyleClass;
		String bottomTDStyleClass;
		if (curTabIndex < numTabs - 1) {
			topTDStyleClass = STYLECLASS_TABS_TD_END_JOINTOINACTIVE;
			bottomTDStyleClass = STYLECLASS_TABS_TD_BOTTOM_END_JOIN;
		} else {
			topTDStyleClass = STYLECLASS_TABS_TD_END;
			bottomTDStyleClass = STYLECLASS_TABS_TD_BOTTOM_END;
		}
		Element topTR = appendChildElement("tr", parentTBody); //$NON-NLS-1$
		Element topTD = appendChildElement("td", topTR); //$NON-NLS-1$
		appendAttribute(topTD, "class", topTDStyleClass); //$NON-NLS-1$
		Element bottomTR = appendChildElement("tr", parentTBody); //$NON-NLS-1$
		Element bottomTD = appendChildElement("td", bottomTR); //$NON-NLS-1$
		appendAttribute(bottomTD, "class", bottomTDStyleClass); //$NON-NLS-1$
		Element div = appendChildElement("div", bottomTD); //$NON-NLS-1$
		appendAttribute(div, "class", STYLECLASS_TABS_DIV_BOTTOM_END_CONTENT); //$NON-NLS-1$
	}

}

Back to the top