<commit_before>package org.minimalj.frontend.impl.json;

import org.minimalj.frontend.Frontend.IComponent;
import org.minimalj.frontend.Frontend.IContent;
import org.minimalj.frontend.Frontend.SwitchComponent;
import org.minimalj.frontend.Frontend.SwitchContent;

public class JsonSwitch extends JsonComponent implements SwitchContent, SwitchComponent {

	private final JsonPageManager jsonPageManager;
	
	public JsonSwitch(JsonPageManager jsonPageManager) {
		super("Switch");
		this.jsonPageManager = jsonPageManager;
	}

	@Override
	public void show(IContent content) {
		jsonPageManager.replaceContent(this, (JsonComponent) content);
	}

	@Override
	public void show(IComponent component) {
		jsonPageManager.replaceContent(this, (JsonComponent) component);
	}
}<commit_msg>JsonSwitch no action if current content is shown again<commit_after>package org.minimalj.frontend.impl.json;

import org.minimalj.frontend.Frontend.IComponent;
import org.minimalj.frontend.Frontend.IContent;
import org.minimalj.frontend.Frontend.SwitchComponent;
import org.minimalj.frontend.Frontend.SwitchContent;

public class JsonSwitch extends JsonComponent implements SwitchContent, SwitchComponent {

	private final JsonPageManager jsonPageManager;
	private Object current;
	
	public JsonSwitch(JsonPageManager jsonPageManager) {
		super("Switch");
		this.jsonPageManager = jsonPageManager;
	}

	@Override
	public void show(IContent content) {
		if (content != current) {
			current = content;
			jsonPageManager.replaceContent(this, (JsonComponent) content);
		}
	}

	@Override
	public void show(IComponent component) {
		if (component != current) {
			current = component;
			jsonPageManager.replaceContent(this, (JsonComponent) component);
		}
	}
}
{'fraction_non_alphanumeric': 0.08813364055299538, 'fraction_numerical': 0.0, 'mean_word_length': 6.089795918367347, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4891514', 'n_tokens_mistral': 530, 'n_tokens_neox': 498, 'n_words': 109}