class DefaultOverview {
	constructor() {
		this.eventSupport = new MyEventSupport();
	}
	
	init() {

		var that = this.window;
		
		
		this.sortedClassNames = [];
		this.namedClasses = [];

		for(var id in that.classes) {
			var item = that.classes[id];
			this.sortedClassNames[this.sortedClassNames.length]=item.name;
			this.namedClasses[item.name] = item;
		}
		this.sortedClassNames.sort();

		
		return this;
	}
	
	
	get iFrame() { 
		if (this._iFrame == null) {
			this._iFrame = document.getElementById("overviewIframe");
		}
		return this._iFrame; 
	}
	get window() { return this.iFrame.contentWindow; }
	get overviewDocument() { return this.window.document; }
	get wodaDocument() { return document; }
	get URL() { return this.iFrame.src; }
	set URL(newValue) { 
		this.iFrame.src = newValue; 
	}
	

	
	
	renderStructrClasses() {
			var classItemBean = this.window.document.weBeans.lookup("StructrSchemaListItem");
			var optionElementBean = this.window.document.weBeans.lookup("StructrSchemaOptionElement");
	

			this.window.Controller = this;


			for(var id in this.sortedClassNames) {
				var item = this.namedClasses[this.sortedClassNames[id]];

				item.onclick="javascript:Controller.select('"+item.name+"')";

				if (!item.isRel)
					classItemBean.append("classesList", item);
				else {
					classItemBean.append("relationsList", item);
					classItemBean.name = item.name+" : Relationship";
				}

				optionElementBean.append("classes", item);
			}


	}
	
	
	select(element) {
		var item = this.namedClasses[element];
		console.log(item);
		this.eventSupport.getEvent("select").fire(this,this.namedClasses[item.name]);
		
	}
	
	
}