<commit_before>package c4lab.iot.smarthomevisualeditor.page;

import java.util.List;

import com.vaadin.ui.Button;
import com.vaadin.ui.TabSheet.Tab;

import c4lab.iot.smarthomevisualeditor.ddsource.UISource;
import c4lab.iot.smarthomevisualeditor.design.EditorPageDesign;
import c4lab.iot.smarthomevisualeditor.ddsource.model.IoTData;
import c4lab.iot.smarthomevisualeditor.ddsource.model.TypeID;
import fi.jasoft.dragdroplayouts.client.ui.LayoutDragMode;

public class EditorPage extends EditorPageDesign {
	private final String roomList[] = { "Living Room", "Bedroom", "Bathroom", "Kitchen" };
	private final String sensorList[] = { "temperature", "humidity", "bright", "Smoke", "CO2", "PIR" };
	private final String applianceList[] = { "ŮMb", "q", "@ؾ", "qO", "x", "Kinect/v", "aH" };
	private Tab tabs[];

	public EditorPage() {
		super();
		accordion.setDragMode(LayoutDragMode.NONE);

		int numOfTab = 0;
		tabs = new Tab[3];
		// ŪroomMBsensorMHήaqMA[Jaccordion
		addTabToAccordion(roomList, "Room", numOfTab++, true);
		// addTabToAccordion(sensorList, "Sensor", numOfTab++, false);
		// addTabToAccordion(applianceList, "Home Appliance", numOfTab++, false);
		
		final IoTData iotData = new IoTData();
		addTabToAccordion(iotData.getTypeIDs(), "Sensor", numOfTab++, false);
		addTabToAccordion(iotData.getTypeIDs(), "Home Appliance", numOfTab++, false);
	}

	private void addTabToAccordion(String[] list, String nameOfTab, int position, boolean isContainer) {
		AccordionTab tab = new AccordionTab();
		
		for (String name : list) {
			UISource rs = new UISource(new Button(name), name);
			rs.setIsContainer(isContainer);		
			tab.addComponentToDDLayout(rs);
		}
		
		tabs[position] = accordion.addTab(tab, position);
		tabs[position].setCaption(nameOfTab);
	}
	
	private void addTabToAccordion(List<TypeID> list, String nameOfTab, int position, boolean isContainer) {
		AccordionTab tab = new AccordionTab();
		
		for(TypeID t : list) {
			System.out.println(t.getName() + " = " + t.getClassID());
			UISource rs = new UISource(new Button(t.getName()), t.getName());
			rs.setIsContainer(isContainer);		
			tab.addComponentToDDLayout(rs);
		}
		
		tabs[position] = accordion.addTab(tab, position);
		tabs[position].setCaption(nameOfTab);
	}
}<commit_msg>UISource set typeid<commit_after>package c4lab.iot.smarthomevisualeditor.page;

import java.util.List;

import com.vaadin.ui.Button;
import com.vaadin.ui.TabSheet.Tab;

import c4lab.iot.smarthomevisualeditor.ddsource.UISource;
import c4lab.iot.smarthomevisualeditor.design.EditorPageDesign;
import c4lab.iot.smarthomevisualeditor.ddsource.model.IoTData;
import c4lab.iot.smarthomevisualeditor.ddsource.model.TypeID;
import fi.jasoft.dragdroplayouts.client.ui.LayoutDragMode;

public class EditorPage extends EditorPageDesign {
	private final String roomList[] = { "Living Room", "Bedroom", "Bathroom", "Kitchen" };
	private final String sensorList[] = { "temperature", "humidity", "bright", "Smoke", "CO2", "PIR" };
	private final String applianceList[] = { "ŮMb", "q", "@ؾ", "qO", "x", "Kinect/v", "aH" };
	private Tab tabs[];

	public EditorPage() {
		super();
		accordion.setDragMode(LayoutDragMode.NONE);

		int numOfTab = 0;
		tabs = new Tab[3];
		// ŪroomMBsensorMHήaqMA[Jaccordion
		addTabToAccordion(roomList, "Room", numOfTab++, true);
		// addTabToAccordion(sensorList, "Sensor", numOfTab++, false);
		// addTabToAccordion(applianceList, "Home Appliance", numOfTab++, false);
		
		final IoTData iotData = new IoTData();
		addTabToAccordion(iotData.getTypeIDs(), "Sensor", numOfTab++, false);
		addTabToAccordion(iotData.getTypeIDs(), "Home Appliance", numOfTab++, false);
	}

	private void addTabToAccordion(String[] list, String nameOfTab, int position, boolean isContainer) {
		AccordionTab tab = new AccordionTab();
		
		for (String name : list) {
			UISource rs = new UISource(new Button(name), name);
			rs.setIsContainer(isContainer);		
			tab.addComponentToDDLayout(rs);
		}
		
		tabs[position] = accordion.addTab(tab, position);
		tabs[position].setCaption(nameOfTab);
	}
	
	private void addTabToAccordion(List<TypeID> list, String nameOfTab, int position, boolean isContainer) {
		AccordionTab tab = new AccordionTab();
		
		for(TypeID t : list) {
			System.out.println(t.getName() + " = " + t.getId());
			UISource rs = new UISource(new Button(t.getName()), t.getName());
			rs.setType(t.getId() + "");
			rs.setIsContainer(isContainer);		
			tab.addComponentToDDLayout(rs);
		}
		
		tabs[position] = accordion.addTab(tab, position);
		tabs[position].setCaption(nameOfTab);
	}
}
{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.0035056967572304996, 'mean_word_length': 5.331484049930652, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5997343', 'n_tokens_mistral': 1742, 'n_tokens_neox': 1588, 'n_words': 313}