<commit_before>package eu.ydp.empiria.player.client.module.textentry;

import java.io.Serializable;
import java.util.List;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.xml.client.Element;
import com.google.gwt.xml.client.NodeList;

import eu.ydp.empiria.player.client.controller.events.interaction.InteractionEventsListener;
import eu.ydp.empiria.player.client.controller.events.interaction.StateChangedInteractionEvent;
import eu.ydp.empiria.player.client.controller.feedback.InlineFeedback;
import eu.ydp.empiria.player.client.controller.variables.objects.response.Response;
import eu.ydp.empiria.player.client.module.Factory;
import eu.ydp.empiria.player.client.module.IActivity;
import eu.ydp.empiria.player.client.module.IStateful;
import eu.ydp.empiria.player.client.module.ModuleJsSocketFactory;
import eu.ydp.empiria.player.client.module.ModuleSocket;
import eu.ydp.empiria.player.client.module.OneViewInteractionModuleBase;
import eu.ydp.empiria.player.client.util.XMLUtils;

public class TextEntryModule extends OneViewInteractionModuleBase implements Factory<TextEntryModule>{

	/** text box control */
	private TextBox textBox;
	/** Last selected value */
	private String	lastValue = null;
	private boolean showingAnswers = false;

	protected Panel moduleWidget;

	/**
	 * constructor
	 * @param moduleSocket
	 */
	public TextEntryModule(){

	}
	@Override
	public void installViews(List<HasWidgets> placeholders) {

		textBox = new TextBox();
		if (getModuleElement().hasAttribute("expectedLength"))
			textBox.setMaxLength(XMLUtils.getAttributeAsInt(getModuleElement(), "expectedLength"));

		textBox.addChangeHandler(new ChangeHandler() {
			@Override
			public void onChange(ChangeEvent event) {
				onTextBoxChange();
			}
		});

		
		if (!getResponse().correctAnswers.get(0).matches(".*[^0-9].*"))
			textBox.getElement().setAttribute("type", "number");

		Panel spanPrefix = new FlowPanel();
		spanPrefix.setStyleName("qp-text-textentry-prefix");
		Panel spanSufix = new FlowPanel();
		spanSufix.setStyleName("qp-text-textentry-sufix");
		Panel spanContent = new FlowPanel();
		spanContent.setStyleName("qp-text-textentry-content");
		spanContent.add(textBox);
<commit_msg>removed type="number" for text entry gaps with number only response bug 66284<commit_after>package eu.ydp.empiria.player.client.module.textentry;

import java.io.Serializable;
import java.util.List;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.xml.client.Element;
import com.google.gwt.xml.client.NodeList;

import eu.ydp.empiria.player.client.controller.events.interaction.InteractionEventsListener;
import eu.ydp.empiria.player.client.controller.events.interaction.StateChangedInteractionEvent;
import eu.ydp.empiria.player.client.controller.feedback.InlineFeedback;
import eu.ydp.empiria.player.client.controller.variables.objects.response.Response;
import eu.ydp.empiria.player.client.module.Factory;
import eu.ydp.empiria.player.client.module.IActivity;
import eu.ydp.empiria.player.client.module.IStateful;
import eu.ydp.empiria.player.client.module.ModuleJsSocketFactory;
import eu.ydp.empiria.player.client.module.ModuleSocket;
import eu.ydp.empiria.player.client.module.OneViewInteractionModuleBase;
import eu.ydp.empiria.player.client.util.XMLUtils;

public class TextEntryModule extends OneViewInteractionModuleBase implements Factory<TextEntryModule>{

	/** text box control */
	private TextBox textBox;
	/** Last selected value */
	private String	lastValue = null;
	private boolean showingAnswers = false;

	protected Panel moduleWidget;

	/**
	 * constructor
	 * @param moduleSocket
	 */
	public TextEntryModule(){

	}
	@Override
	public void installViews(List<HasWidgets> placeholders) {

		textBox = new TextBox();
		if (getModuleElement().hasAttribute("expectedLength"))
			textBox.setMaxLength(XMLUtils.getAttributeAsInt(getModuleElement(), "expectedLength"));

		textBox.addChangeHandler(new ChangeHandler() {
			@Override
			public void onChange(ChangeEvent event) {
				onTextBoxChange();
			}
		});

		Panel spanPrefix = new FlowPanel();
		spanPrefix.setStyleName("qp-text-textentry-prefix");
		Panel spanSufix = new FlowPanel();
		spanSufix.setStyleName("qp-text-textentry-sufix");
		Panel spanContent = new FlowPanel();
		spanContent.setStyleName("qp-text-textentry-content");
		spanContent.add(textBox);

{'fraction_non_alphanumeric': 0.12140637140637141, 'fraction_numerical': 0.001554001554001554, 'mean_word_length': 5.626769626769627, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '140254', 'n_tokens_mistral': 1710, 'n_tokens_neox': 1637, 'n_words': 251}