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

de.citec.tcs.alignment.visualization.toggleColumn.js Maven / Gradle / Ivy

Go to download

This module contains means to visualize Alignments. The most important interface is the Visualizer class. A trivial implementation (essentially just using toString()) is the StringVisualizer. A more sophisticated example that is recommended for outside use is the HTMLVisualizer. All other classes are helper classes for said HTMLVisualizer.

The newest version!
/**
 * Sets the visibility of a column given the checkbox that has been changed by
 * a user.
 */
function toggleColumn(checkBox) {
	// get the "checked" status of the checkbox, meaning whether we
	// should show the element (true) or not (false)
	var checked = checkBox.checked;
	// get the keyword, which is specified by the id of the checkbox.
	var key = checkBox.id;
	// use a CSS selector to get the column of the table that contains
	// data for that keyword.
	var selector = "table#alignTable th#" + key + " , table#alignTable td#" + key;
	// look if we have an alignFrame.
	var doc;
	if(window.frames['alignFrame']){
		// retrieve frame document.
		doc = window.frames['alignFrame'].contentDocument;
		if(!doc){
			doc=document.getElementById("alignFrame").contentWindow.document;
		}
	} else{
		doc = document;
	}
	var tds = doc.querySelectorAll(selector);
	// set the display attribute for all those elements accordingly.
	for (var i = 0; i < tds.length; i++) {
		if (checked) {
			tds[i].style.display = "";
		} else {
			tds[i].style.display = "none";
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy