<commit_before>package fr.openwide.core.wicket.more.markup.html.image;

import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.model.IModel;

/**
 * Container utilisant les glyphicons de Bootstrap et affichant
 * un tick ou une croix selon que le model soit true ou false.
 */
public class BooleanGlyphicon extends WebMarkupContainer {

	private static final long serialVersionUID = -7046943814231028574L;

	private static final String CLASS_ATTRIBUTE = "class";
	private static final String CLASS_SEPARATOR = " ";

	private static final String BOOTSTRAP_ICON_CLASS = "icon";
	private static final String BOOTSTRAP_TRUE_ICON_CLASS = "icon-ok";
	private static final String BOOTSTRAP_FALSE_ICON_CLASS = "icon-remove";

	public BooleanGlyphicon(String id, IModel<Boolean> booleanModel) {
		super(id, booleanModel);
	}

	@Override
	public void onComponentTag(final ComponentTag tag) {
		Boolean value = getValue();
		
		tag.append(CLASS_ATTRIBUTE, BOOTSTRAP_ICON_CLASS, CLASS_SEPARATOR);
		if (value != null && value) {
			tag.append(CLASS_ATTRIBUTE, BOOTSTRAP_TRUE_ICON_CLASS, CLASS_SEPARATOR);
		} else {
			tag.append(CLASS_ATTRIBUTE, BOOTSTRAP_FALSE_ICON_CLASS, CLASS_SEPARATOR);
		}
		super.onComponentTag(tag);
	}

	@Override
	public boolean isVisible() {
		return super.isVisible() && (getValue() != null);
	}

	private Boolean getValue() {
		return (Boolean) getDefaultModelObject();
	}<commit_msg>BooleanGlyphicon :  * suppression de la class "icon"  * ajout d'un booléen permettant de cacher l'icon si la valeur est à false<commit_after>package fr.openwide.core.wicket.more.markup.html.image;

import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.model.IModel;

/**
 * Container utilisant les glyphicons de Bootstrap et affichant
 * un tick ou une croix selon que le model soit true ou false.
 */
public class BooleanGlyphicon extends WebMarkupContainer {

	private static final long serialVersionUID = -7046943814231028574L;

	private static final String CLASS_ATTRIBUTE = "class";
	private static final String CLASS_SEPARATOR = " ";

	private static final String BOOTSTRAP_TRUE_ICON_CLASS = "icon-ok";
	private static final String BOOTSTRAP_FALSE_ICON_CLASS = "icon-remove";

	private boolean showFalseIcon;
	
	public BooleanGlyphicon(String id, IModel<Boolean> booleanModel) {
		this(id, booleanModel, true);
	}
	
	public BooleanGlyphicon(String id, IModel<Boolean> booleanModel, boolean showFalseIcon) {
		super(id, booleanModel);
		this.showFalseIcon = showFalseIcon;
	}

	@Override
	public void onComponentTag(final ComponentTag tag) {
		Boolean value = getValue();
		
		if (value != null && value) {
			tag.append(CLASS_ATTRIBUTE, BOOTSTRAP_TRUE_ICON_CLASS, CLASS_SEPARATOR);
		} else if (showFalseIcon) {
			tag.append(CLASS_ATTRIBUTE, BOOTSTRAP_FALSE_ICON_CLASS, CLASS_SEPARATOR);
		}
		super.onComponentTag(tag);
	}

	@Override
	public boolean isVisible() {
		return super.isVisible() && (getValue() != null);
	}

	private Boolean getValue() {
		return (Boolean) getDefaultModelObject();
	}
{'fraction_non_alphanumeric': 0.09318541996830428, 'fraction_numerical': 0.012044374009508717, 'mean_word_length': 5.312, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '5717123', 'n_tokens_mistral': 1080, 'n_tokens_neox': 1002, 'n_words': 254}