<commit_before>package org.csstudio.opibuilder.adl2boy.translator;

import org.csstudio.opibuilder.model.AbstractContainerModel;
import org.csstudio.opibuilder.model.AbstractWidgetModel;
import org.csstudio.opibuilder.widgets.model.GroupingContainerModel;
import org.csstudio.opibuilder.widgets.model.LinkingContainerModel;
import org.csstudio.utility.adlparser.fileParser.ADLWidget;
import org.csstudio.utility.adlparser.fileParser.widgets.Composite;
import org.eclipse.swt.graphics.RGB;

public class Composite2Model extends AbstractADL2Model {
	AbstractContainerModel containerModel;

	public Composite2Model(ADLWidget adlWidget, RGB[] colorMap, AbstractContainerModel parentModel) {
		super(adlWidget, colorMap, parentModel);
		Composite compositeWidget = new Composite(adlWidget);

		if (!compositeWidget.hasCompositeFile()) {
			containerModel = new LinkingContainerModel();
		}
		else {
			containerModel = new GroupingContainerModel();
		}
		parentModel.addChild(containerModel, true);
		containerModel.setBackgroundColor(parentModel.getBackgroundColor());
		containerModel.setForegroundColor(parentModel.getForegroundColor());
		if (compositeWidget != null) {
			setADLObjectProps(compositeWidget, containerModel);
			if (compositeWidget != null) {
				setADLObjectProps(compositeWidget, containerModel);
			}
		}
		if (!compositeWidget.hasCompositeFile()) {
		}
		else {
			TranslatorUtils.ConvertChildren(compositeWidget.getChildWidgets(), containerModel, colorMap);
			((GroupingContainerModel)(containerModel)).setPropertyValue(GroupingContainerModel.PROP_SHOW_SCROLLBAR, false);
			FixChildPositions();
		}
		//Add Dynamic Properties to Composite2Model
		//Add Composite File to Composite2Model
	}

	@Override
	public	AbstractWidgetModel getWidgetModel() {
		return containerModel;
	}

	private void FixChildPositions() {
		int compositeX = containerModel.getX();
		int compositeY = containerModel.getY();
		
		for (AbstractWidgetModel model : containerModel.getChildren()){<commit_msg>Fix logic if there is a compositeFile defined.  This determines if the composite maps to a grouping container (no) or Linking container(yes)<commit_after>package org.csstudio.opibuilder.adl2boy.translator;

import org.csstudio.opibuilder.model.AbstractContainerModel;
import org.csstudio.opibuilder.model.AbstractWidgetModel;
import org.csstudio.opibuilder.widgets.model.GroupingContainerModel;
import org.csstudio.opibuilder.widgets.model.LinkingContainerModel;
import org.csstudio.utility.adlparser.fileParser.ADLWidget;
import org.csstudio.utility.adlparser.fileParser.widgets.Composite;
import org.eclipse.swt.graphics.RGB;

public class Composite2Model extends AbstractADL2Model {
	AbstractContainerModel containerModel;

	public Composite2Model(ADLWidget adlWidget, RGB[] colorMap, AbstractContainerModel parentModel) {
		super(adlWidget, colorMap, parentModel);
		Composite compositeWidget = new Composite(adlWidget);

		if (compositeWidget.hasCompositeFile()) {
			containerModel = new LinkingContainerModel();
		}
		else {
			containerModel = new GroupingContainerModel();
		}
		parentModel.addChild(containerModel, true);
		containerModel.setBackgroundColor(parentModel.getBackgroundColor());
		containerModel.setForegroundColor(parentModel.getForegroundColor());
		if (compositeWidget != null) {
			setADLObjectProps(compositeWidget, containerModel);
			if (compositeWidget != null) {
				setADLObjectProps(compositeWidget, containerModel);
			}
		}
		if (compositeWidget.hasCompositeFile()) {
		}
		else {
			TranslatorUtils.ConvertChildren(compositeWidget.getChildWidgets(), containerModel, colorMap);
			((GroupingContainerModel)(containerModel)).setPropertyValue(GroupingContainerModel.PROP_SHOW_SCROLLBAR, false);
			FixChildPositions();
		}
		//Add Dynamic Properties to Composite2Model
		//Add Composite File to Composite2Model
	}

	@Override
	public	AbstractWidgetModel getWidgetModel() {
		return containerModel;
	}

	private void FixChildPositions() {
		int compositeX = containerModel.getX();
		int compositeY = containerModel.getY();
		
		for (AbstractWidgetModel model : containerModel.getChildren()){
{'fraction_non_alphanumeric': 0.09187878787878788, 'fraction_numerical': 0.002909090909090909, 'mean_word_length': 6.47463768115942, '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': '7596003', 'n_tokens_mistral': 1304, 'n_tokens_neox': 1205, 'n_words': 216}