<commit_before>package org.genericsystem.reactor.gscomponents3;

import org.genericsystem.reactor.modelproperties.ComponentsDefaults;
import org.genericsystem.reactor.modelproperties.SelectionDefaults;

import org.genericsystem.reactor.htmltag.HtmlOption;
import org.genericsystem.reactor.htmltag.HtmlSelect;

import org.genericsystem.reactor.annotations.BindText;
import org.genericsystem.reactor.annotations.Children;
import org.genericsystem.reactor.annotations.ForEach;
import org.genericsystem.reactor.annotations.Style.GenericValueBackgroundColor;
import org.genericsystem.reactor.gscomponents3.GSSelect.HtmlRepeatedOption;
import org.genericsystem.reactor.model.ObservableListExtractor;
import org.genericsystem.reactor.model.StringExtractor;

@Children(HtmlOption.class)
@BindText(path = HtmlRepeatedOption.class)
@ForEach(path = HtmlOption.class, value = ObservableListExtractor.SUBINSTANCES.class)
@GenericValueBackgroundColor(path = HtmlOption.class, value = "")
public class GSSelect extends HtmlSelect implements SelectionDefaults, ComponentsDefaults {

	public static class HtmlRepeatedOption extends HtmlOption {
	}

	@Override
	public void init() {
		createSelectionProperty();
		bindBiDirectionalSelection(find(HtmlOption.class));
		addPrefixBinding(context -> {
			if ("Color".equals(StringExtractor.SIMPLE_CLASS_EXTRACTOR.apply(context.getGeneric()))) {
				getSelectionString(context).addListener((o, old, newValue) -> addStyle(context, "background-color", newValue));
				addStyle(context, "background-color", getSelectionString(context).getValue());
			}
		});
	}

	@Children({ HtmlOption.class, HtmlRepeatedOption.class })
	@ForEach(path = HtmlOption.class, pos = 0, value = ObservableListExtractor.NO_FOR_EACH.class)
	@ForEach(path = HtmlOption.class, pos = 1, value = ObservableListExtractor.SUBINSTANCES.class)
	public static class GSSelectWithEmptyEntry extends GSSelect {

		@Override
		public void init() {
			setSelectionShift(1);
			createSelectionProperty();
			bindBiDirectionalSelection(find(HtmlOption.class, 1));
			addPrefixBinding(context -> {
				if ("Color".equals(StringExtractor.SIMPLE_CLASS_EXTRACTOR.apply(context.getGeneric()))) {
					getSelectionString(context).addListener((o, old, newValue) -> addStyle(context, "background-color", newValue));
					addStyle(context, "background-color", getSelectionString(context).getValue());
				}
			});
		}
	}

	@ForEach(path = HtmlOption.class, value = ObservableListExtractor.SUBINSTANCES_OF_META.class)
	public static class InstanceCompositeSelect extends GSSelect {
		@Override
		public void init() {
			super.init();
			addPostfixBinding(model -> {
				if ("Color".equals(StringExtractor.SIMPLE_CLASS_EXTRACTOR.apply(model.getGeneric().getMeta())))
					addStyle(model, "background-color", getSelectionString(model).getValue());
			});
			addPostfixBinding(model -> getSelectionProperty(model).addListener((ov, ova, nva) -> model.getGenerics()[1].updateComponent(nva.getGeneric(), model.getGenerics()[1].getComponents().indexOf(model.getGeneric()))));
		}
	}
}
<commit_msg>gs-reactor: GSSelect: Use the right class in children<commit_after>package org.genericsystem.reactor.gscomponents3;

import org.genericsystem.reactor.modelproperties.ComponentsDefaults;
import org.genericsystem.reactor.modelproperties.SelectionDefaults;

import org.genericsystem.reactor.htmltag.HtmlOption;
import org.genericsystem.reactor.htmltag.HtmlSelect;

import org.genericsystem.reactor.annotations.BindText;
import org.genericsystem.reactor.annotations.Children;
import org.genericsystem.reactor.annotations.ForEach;
import org.genericsystem.reactor.annotations.Style.GenericValueBackgroundColor;
import org.genericsystem.reactor.gscomponents3.GSSelect.HtmlRepeatedOption;
import org.genericsystem.reactor.model.ObservableListExtractor;
import org.genericsystem.reactor.model.StringExtractor;

@Children(HtmlRepeatedOption.class)
@BindText(path = HtmlRepeatedOption.class)
@ForEach(path = HtmlRepeatedOption.class, value = ObservableListExtractor.SUBINSTANCES.class)
@GenericValueBackgroundColor(path = HtmlOption.class, value = "")
public class GSSelect extends HtmlSelect implements SelectionDefaults, ComponentsDefaults {

	public static class HtmlRepeatedOption extends HtmlOption {
	}

	@Override
	public void init() {
		createSelectionProperty();
		bindBiDirectionalSelection(find(HtmlOption.class));
		addPrefixBinding(context -> {
			if ("Color".equals(StringExtractor.SIMPLE_CLASS_EXTRACTOR.apply(context.getGeneric()))) {
				getSelectionString(context).addListener((o, old, newValue) -> addStyle(context, "background-color", newValue));
				addStyle(context, "background-color", getSelectionString(context).getValue());
			}
		});
	}

	@Children({ HtmlOption.class, HtmlRepeatedOption.class })
	@ForEach(path = HtmlOption.class, pos = 0, value = ObservableListExtractor.NO_FOR_EACH.class)
	@ForEach(path = HtmlOption.class, pos = 1, value = ObservableListExtractor.SUBINSTANCES.class)
	public static class GSSelectWithEmptyEntry extends GSSelect {

		@Override
		public void init() {
			setSelectionShift(1);
			createSelectionProperty();
			bindBiDirectionalSelection(find(HtmlOption.class, 1));
			addPrefixBinding(context -> {
				if ("Color".equals(StringExtractor.SIMPLE_CLASS_EXTRACTOR.apply(context.getGeneric()))) {
					getSelectionString(context).addListener((o, old, newValue) -> addStyle(context, "background-color", newValue));
					addStyle(context, "background-color", getSelectionString(context).getValue());
				}
			});
		}
	}

	@ForEach(path = HtmlOption.class, value = ObservableListExtractor.SUBINSTANCES_OF_META.class)
	public static class InstanceCompositeSelect extends GSSelect {
		@Override
		public void init() {
			super.init();
			addPostfixBinding(model -> {
				if ("Color".equals(StringExtractor.SIMPLE_CLASS_EXTRACTOR.apply(model.getGeneric().getMeta())))
					addStyle(model, "background-color", getSelectionString(model).getValue());
			});
			addPostfixBinding(model -> getSelectionProperty(model).addListener((ov, ova, nva) -> model.getGenerics()[1].updateComponent(nva.getGeneric(), model.getGenerics()[1].getComponents().indexOf(model.getGeneric()))));
		}
	}
}

{'fraction_non_alphanumeric': 0.11978661493695442, 'fraction_numerical': 0.0025864856126737797, 'mean_word_length': 6.704856787048568, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '2564514', 'n_tokens_mistral': 1989, 'n_tokens_neox': 1825, 'n_words': 275}