<commit_before>package de.prob2.ui.visualisation.magiclayout.editPane;

import java.util.ResourceBundle;

import com.google.inject.Inject;

import de.prob2.ui.internal.StageManager;
import de.prob2.ui.visualisation.magiclayout.MagicComponent;
import de.prob2.ui.visualisation.magiclayout.MagicNodes;
import de.prob2.ui.visualisation.magiclayout.MagicShape;
import javafx.fxml.FXML;
import javafx.geometry.Insets;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ColorPicker;
import javafx.scene.control.ComboBox;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.scene.paint.Color;

public class MagicLayoutEditNodes extends MagicLayoutEditPane {

	private class MagicShapeListCell extends ListCell<MagicShape> {
		@Override
		protected void updateItem(MagicShape shape, boolean empty) {
			super.updateItem(shape, empty);
			setText((shape == null || empty) ? "" : bundle.getString(shape.getBundleKey()));
		}
	}

	private CheckBox clusterCheckBox;
	private ComboBox<MagicShape> shapeComboBox;
	private ColorPicker nodeColorPicker;

	@Inject
	public MagicLayoutEditNodes(final StageManager stageManager, final ResourceBundle bundle) {
		super(stageManager, bundle);
	}

	@FXML
	public void initialize() {
		super.initialize();
		
		expressionTextArea.setPromptText("{x|...}");

		// add DummyData
		listView.getItems().addAll(new MagicNodes("nodes1", "{x1|...}"), new MagicNodes("nodes2", "{x2|...}"),
				new MagicNodes("nodes3", "{x3|...}"), new MagicNodes("nodes4", "{x4|...}"),
				new MagicNodes("nodes5", "{x5|...}"), new MagicNodes("nodes6", "{x6|...}"),
				new MagicNodes("nodes7", "{x7|...}"), new MagicNodes("nodes8", "{x8|...}"));

		// add Node specific controls
		clusterCheckBox = new CheckBox(bundle.getString("visualisation.magicLayout.editPane.labels.cluster"));
		setMargin(clusterCheckBox, new Insets(0, 5, 0, 10));
		this.getChildren().add(2, clusterCheckBox);

		shapeComboBox = new ComboBox<>();
		shapeComboBox.getItems().setAll(MagicShape.values());
		shapeComboBox.setCellFactory((ListView<MagicShape> lv) -> new MagicShapeListCell());
		shapeComboBox.setButtonCell(new MagicShapeListCell());
		shapeComboBox.getSelectionModel().selectFirst();

		nodeColorPicker = new ColorPicker();
		flowPane.getChildren().addAll(
				wrapInVBox(bundle.getString("visualisation.magicLayout.editPane.labels.shape"), shapeComboBox),
				wrapInVBox(bundle.getString("visualisation.magicLayout.editPane.labels.color"), nodeColorPicker));
	}

	@Override
	void updateValues(MagicComponent selectedComponent) {
		super.updateValues(selectedComponent);

		if (selectedComponent != null) {
			MagicNodes selectedNodes = (MagicNodes) selectedComponent;

			clusterCheckBox.setSelected(selectedNodes.isCluster());
			selectedNodes.clusterProperty().bind(clusterCheckBox.selectedProperty());

			shapeComboBox.setValue(selectedNodes.getShape());
			selectedNodes.shapeProperty().bind(shapeComboBox.valueProperty());

			nodeColorPicker.setValue(selectedNodes.getNodeColor());
			selectedNodes.nodeColorProperty().bind(nodeColorPicker.valueProperty());
		} else {
			clusterCheckBox.setSelected(false);
			shapeComboBox.getSelectionModel().selectFirst();
			nodeColorPicker.setValue(Color.WHITE);
		}
	}

	public void addNodes() {
		MagicNodes nodes = new MagicNodes("nodes");
		super.addMagicComponent(nodes);
	}

}
<commit_msg>add Sets from Machine as Node Groups and remove Dummy Nodes Data (2)<commit_after>package de.prob2.ui.visualisation.magiclayout.editPane;

import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;

import com.google.inject.Inject;

import de.prob.animator.command.EvaluateFormulasCommand;
import de.prob.animator.domainobjects.AbstractEvalResult;
import de.prob.animator.domainobjects.IEvalElement;
import de.prob.statespace.StateSpace;
import de.prob2.ui.internal.StageManager;
import de.prob2.ui.prob2fx.CurrentTrace;
import de.prob2.ui.visualisation.magiclayout.MagicComponent;
import de.prob2.ui.visualisation.magiclayout.MagicNodes;
import de.prob2.ui.visualisation.magiclayout.MagicShape;
import javafx.fxml.FXML;
import javafx.geometry.Insets;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ColorPicker;
import javafx.scene.control.ComboBox;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.scene.paint.Color;

public class MagicLayoutEditNodes extends MagicLayoutEditPane {

	private class MagicShapeListCell extends ListCell<MagicShape> {
		@Override
		protected void updateItem(MagicShape shape, boolean empty) {
			super.updateItem(shape, empty);
			setText((shape == null || empty) ? "" : bundle.getString(shape.getBundleKey()));
		}
	}

	private CheckBox clusterCheckBox;
	private ComboBox<MagicShape> shapeComboBox;
	private ColorPicker nodeColorPicker;

	@Inject
	public MagicLayoutEditNodes(final StageManager stageManager, final ResourceBundle bundle,
			final CurrentTrace currentTrace) {
		super(stageManager, bundle, currentTrace);
	}

	@FXML
	public void initialize() {
		super.initialize();

		expressionTextArea.setPromptText("{x|...}");

		// add Node specific controls
		clusterCheckBox = new CheckBox(bundle.getString("visualisation.magicLayout.editPane.labels.cluster"));
		setMargin(clusterCheckBox, new Insets(0, 5, 0, 10));
		this.getChildren().add(2, clusterCheckBox);

		shapeComboBox = new ComboBox<>();
		shapeComboBox.getItems().setAll(MagicShape.values());
		shapeComboBox.setCellFactory((ListView<MagicShape> lv) -> new MagicShapeListCell());
		shapeComboBox.setButtonCell(new MagicShapeListCell());
		shapeComboBox.getSelectionModel().selectFirst();

		nodeColorPicker = new ColorPicker();
		flowPane.getChildren().addAll(
				wrapInVBox(bundle.getString("visualisation.magicLayout.editPane.labels.shape"), shapeComboBox),
				wrapInVBox(bundle.getString("visualisation.magicLayout.editPane.labels.color"), nodeColorPicker));

		// add Sets from Machine as Node Groups
		currentTrace.addListener((observable, from, to) -> {
			if (to != null && to.getStateSpace() != null) {
				this.listView.getItems().clear();
				this.updateValues();
				
				StateSpace stateSpace = currentTrace.getStateSpace();
				
				List<IEvalElement> setEvalElements = stateSpace.getLoadedMachine().getSetEvalElements();
				final EvaluateFormulasCommand setEvalCmd = new EvaluateFormulasCommand(setEvalElements,
						currentTrace.getCurrentState().getId());
				stateSpace.execute(setEvalCmd);
				Map<IEvalElement, AbstractEvalResult> setResultMap = setEvalCmd.getResultMap();
				for(IEvalElement element : setResultMap.keySet()) {
					MagicNodes magicNodes = new MagicNodes(element.toString(), setResultMap.get(element).toString());
					listView.getItems().add(magicNodes);
				}
			}
		});


	}

	@Override
	void updateValues(MagicComponent selectedComponent) {
		super.updateValues(selectedComponent);

		if (selectedComponent != null) {
			MagicNodes selectedNodes = (MagicNodes) selectedComponent;

			clusterCheckBox.setSelected(selectedNodes.isCluster());
			selectedNodes.clusterProperty().bind(clusterCheckBox.selectedProperty());

			shapeComboBox.setValue(selectedNodes.getShape());
			selectedNodes.shapeProperty().bind(shapeComboBox.valueProperty());

			nodeColorPicker.setValue(selectedNodes.getNodeColor());
			selectedNodes.nodeColorProperty().bind(nodeColorPicker.valueProperty());
		} else {
			clusterCheckBox.setSelected(false);
			shapeComboBox.getSelectionModel().selectFirst();
			nodeColorPicker.setValue(Color.WHITE);
		}
	}

	public void addNodes() {
		MagicNodes nodes = new MagicNodes("nodes");
		super.addMagicComponent(nodes);
	}

}

{'fraction_non_alphanumeric': 0.12598013591217982, 'fraction_numerical': 0.0053580763199163614, 'mean_word_length': 5.919529837251356, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3407287', 'n_tokens_mistral': 2493, 'n_tokens_neox': 2224, 'n_words': 383}