var mason = {};

mason.Application = Class
		.extend({
			NAME : "mason.Application",

			/**
			 * @constructor
			 * 
			 * @param {String}
			 *            canvasId the id of the DOM element to use as paint
			 *            container
			 */
			init : function() {
				
				this.view = new mason.View("canvas");
				this.toolbar = new mason.Toolbar("toolbar", this, this.view);
				
				$('#new-element').hide();
				
				// layout FIRST the body
				this.appLayout = $('#container').layout({
					west : {
						resizable : true,
						closable : true,
						resizeWhileDragging : true,
						paneSelector : "#navigation"
					},
					center : {
						resizable : true,
						closable : true,
						resizeWhileDragging : true,
						paneSelector : "#content"
					}
				});

				//
				this.contentLayout = $('#content').layout({
					north : {
						resizable : false,
						closable : false,
						spacing_open : 0,
						spacing_closed : 0,
						size : 50,
						paneSelector : "#toolbar"
					},
					center : {
						resizable : false,
						closable : false,
						spacing_open : 0,
						spacing_closed : 0,
						paneSelector : "#canvas"
					}
				});
			},

			layout : function() {
				this.appLayout.resizeAll();
			},

			loadWorkspace : function(key) {
				var this_ = this;
				jQuery.ajax({
					type : "GET",
					dataType : "json",
					url : '/json/access/loggedIn/',
					success : function(data, statusText) {
						if (data == 1 ) {
							this_.toolbar.getViews(key, false);
						} else {
							alert("gelieve eerst aan te melden");
						}
					},
					error : function(xhr, ajaxOptions, thrownError) {
						Console.log('FOUT: Send change text');
					}
				});
				
			}

		});


/**
 * @method
 * Factory method to provide a default connection for all drag&drop connections. You
 * can override this method and customize this for your personal purpose.
 * 
 * @param {draw2d.port} sourcePort port of the source of the connection
 * @param {draw2d.port} targetPort port of the target of the connection
 * @template
 * @returns {draw2d.Connection}
 */
draw2d.Connection.createConnection=function(sourcePort, targetPort){
    
    return new mason.Relationship();
};