<commit_before>package com.github.dandelion.datatables.core.export;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.github.dandelion.datatables.core.asset.JsResource;
import com.github.dandelion.datatables.core.callback.Callback;
import com.github.dandelion.datatables.core.callback.CallbackType;
import com.github.dandelion.datatables.core.html.HtmlDiv;
import com.github.dandelion.datatables.core.html.HtmlHyperlink;
import com.github.dandelion.datatables.core.html.HtmlTable;

/**
 * 
 *
 * @author <NAME>
 */
public class ExportManager {

	// Logger
	private static Logger logger = LoggerFactory.getLogger(ExportManager.class);
		
	/**
	 * <p>
	 * If the export attribute of the table tag has been set to true, this
	 * method will convert every ExportConf bean to a HTML link, corresponding
	 * to each activated export type.
	 * 
	 * <p>
	 * All the link are wrapped into a div which is inserted in the DOM using
	 * jQuery. The wrapping div can be inserted at multiple position, depending
	 * on the tag configuration.
	 * 
	 * <p>
	 * If the user didn't add any ExportTag, Dandelion-datatables will use the default
	 * configuration.
	 * 
	 * @param table
	 *            The HTML table where to get ExportConf beans.
	 * @param mainJsFile
	 *            The web resource to update
	 */
	public void exportManagement(HtmlTable table, JsResource mainJsFile) {

		StringBuilder links = new StringBuilder();
		for (ExportLinkPosition position : table.getTableConfiguration().getExportLinkPositions()) {

			// Init the wrapping HTML div
			HtmlDiv divExport = initExportDiv(table, mainJsFile);
			
			switch (position) {
			case BOTTOM_LEFT:
				divExport.addCssStyle("float:left;margin-right:10px;");
				links.append("$('#" + table.getId()
						+ "_info').before('" + divExport.toHtml() + "');$('#" + table.getId()
						+ "_info').css('clear', 'none');");
				break;

			case BOTTOM_MIDDLE:
				divExport.addCssStyle("float:left;margin-left:10px;");
				links.append("$('#" + table.getId()
						+ "_paginate').before('" + divExport.toHtml() + "');");
				break;

			case BOTTOM_RIGHT:
				divExport.addCssStyle("float:right;");
				links.append("$('#" + table.getId()
						+ "_paginate').before('" + divExport.toHtml() + "');");
				break;

			case TOP_LEFT:
				divExport.addCssStyle("float:left;margin-right:10px;");
				links.append("$('#" + table.getId()
						+ "_length').before('" + divExport.toHtml() + "');");
				break;

			case TOP_MIDDLE:
				divExport.addCssStyle("float:left;margin-left:10px;");
				links.append("$('#" + table.getId()
						+ "_filter').before('" + divExport.toHtml() + "');");
				break;

			case TOP_RIGHT:
				divExport.addCssStyle("float:right;");
				links.append("$('#" + table.getId()
						+ "_filter').before('" + divExport.toHtml() + "');");
				break;

			default:
				break;
			}
		}

		if(table.getTableConfiguration().hasCallback(CallbackType.INIT)){<commit_msg>Export links are now independant<commit_after>package com.github.dandelion.datatables.core.export;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.github.dandelion.datatables.core.asset.JsResource;
import com.github.dandelion.datatables.core.callback.Callback;
import com.github.dandelion.datatables.core.callback.CallbackType;
import com.github.dandelion.datatables.core.html.HtmlDiv;
import com.github.dandelion.datatables.core.html.HtmlHyperlink;
import com.github.dandelion.datatables.core.html.HtmlTable;

/**
 * 
 *
 * @author <NAME>
 */
public class ExportManager {

	// Logger
	private static Logger logger = LoggerFactory.getLogger(ExportManager.class);
		
	/**
	 * <p>
	 * If the export attribute of the table tag has been set to true, this
	 * method will convert every ExportConf bean to a HTML link, corresponding
	 * to each activated export type.
	 * 
	 * <p>
	 * All the link are wrapped into a div which is inserted in the DOM using
	 * jQuery. The wrapping div can be inserted at multiple position, depending
	 * on the tag configuration.
	 * 
	 * <p>
	 * If the user didn't add any ExportTag, Dandelion-datatables will use the default
	 * configuration.
	 * 
	 * @param table
	 *            The HTML table where to get ExportConf beans.
	 * @param mainJsFile
	 *            The web resource to update
	 */
	public void exportManagement(HtmlTable table, JsResource mainJsFile) {

		StringBuilder links = new StringBuilder();
		for (ExportLinkPosition position : table.getTableConfiguration().getExportLinkPositions()) {

			// Init the wrapping HTML div
			HtmlDiv divExport = initExportDiv(table, mainJsFile);
			
			switch (position) {
			case BOTTOM_LEFT:
				divExport.addCssStyle("float:left;margin-right:10px;");
				links.append("$('#" + table.getId() + "').after('" + divExport.toHtml() + "');");
				links.append("$('#" + table.getId() + "_info').css('clear', 'none');");
				break;

			case BOTTOM_MIDDLE:
				divExport.addCssStyle("float:left;margin-left:10px;");
				links.append("$('#" + table.getId() + "_wrapper').append('" + divExport.toHtml() + "');");
				break;

			case BOTTOM_RIGHT:
				divExport.addCssStyle("float:right;");
				links.append("$('#" + table.getId()	+ "').after('" + divExport.toHtml() + "');");
				links.append("$('#" + table.getId() + "_info').css('clear', 'none');");
				break;

			case TOP_LEFT:
				divExport.addCssStyle("float:left;margin-right:10px;");
				links.append("$('#" + table.getId() + "_wrapper').prepend('" + divExport.toHtml() + "');");
				break;

			case TOP_MIDDLE:
				divExport.addCssStyle("float:left;margin-left:10px;");
				links.append("$('#" + table.getId()	+ "').before('" + divExport.toHtml() + "');");
				break;

			case TOP_RIGHT:
				divExport.addCssStyle("float:right;");
				links.append("$('#" + table.getId()	+ "_wrapper').prepend('" + divExport.toHtml() + "');");
				break;

			default:
				break;
			}
		}

		if(table.getTableConfiguration().hasCallback(CallbackType.INIT)){
{'fraction_non_alphanumeric': 0.15636057287278854, 'fraction_numerical': 0.003369839932603201, 'mean_word_length': 3.8417618270799347, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '264154', 'n_tokens_mistral': 2187, 'n_tokens_neox': 1887, 'n_words': 410}