All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.myfaces.custom.tabbedpane.resource.dynamicTabs.js Maven / Gradle / Ivy

Go to download

JSF components and utilities that can be used with any JSF implementation. This library is compatible with both JSF1.1 and JSF1.2; however for JSF1.2 users there is an alternative build of Tomahawk available that takes advantage of JSF1.2 features to offer some additional benefits.

There is a newer version: 1.1.14
Show newest version
function myFaces_showPanelTab(
	tabIndex, tabIndexSubmitFieldID,
	headerId, paneId,
	allHeaderCellsIDs, allPanesIDs,
	activeHeaderStyleClass, inactiveHeaderStyleClass,
	activeSubHeaderStyleClass, inactiveSubHeaderStyleClass){

	if( ! document.getElementById ) // Too Old Browser. Fallback on server side switch
		return true;
		
	document.getElementById(tabIndexSubmitFieldID).value = tabIndex;

	// Change Headers styles
	for(var i = 0; i < allHeaderCellsIDs.length; i++){
		var styleClass;
		if( headerId == allHeaderCellsIDs[i] ){
			styleClass = "myFaces_panelTabbedPane_activeHeaderCell";
			if( activeHeaderStyleClass != null )
				styleClass += " "+activeHeaderStyleClass;
		}else{
			styleClass = "myFaces_panelTabbedPane_inactiveHeaderCell";
			if( inactiveHeaderStyleClass != null )
				styleClass += " "+inactiveHeaderStyleClass
		}
		
		var headerCell = document.getElementById(allHeaderCellsIDs[i]);
		headerCell.className = styleClass;
	}
	
	// Sub Headers
	for(var i = 0; i < allHeaderCellsIDs.length; i++){
		var styleClasses = "myFaces_panelTabbedPane_subHeaderCell";
		if( i == 0 )
			styleClasses += " myFaces_panelTabbedPane_subHeaderCell_first";
		if( headerId == allHeaderCellsIDs[i] ){
			styleClasses += " myFaces_panelTabbedPane_subHeaderCell_active";
			if( activeSubHeaderStyleClass != null )
				styleClasses += " "+activeSubHeaderStyleClass;
		}else{
			styleClasses += " myFaces_panelTabbedPane_subHeaderCell_inactive";
			if( inactiveHeaderStyleClass != null )
				styleClasses += " "+inactiveSubHeaderStyleClass;
		}
		
		var subHeaderCell = document.getElementById(allHeaderCellsIDs[i]+"_sub");
		subHeaderCell.className = styleClasses;
	}
	
	// Switch pane content
	for(var i = 0; i < allPanesIDs.length; i++){
		document.getElementById(allPanesIDs[i]).style.display = (paneId == allPanesIDs[i]) ? 'block':'none';
	}

	return false;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy