/* --------------------- db table ------------ */ SQL.Table = function(owner, name, x, y, z) { this.owner = owner; this.rows = []; this.keys = []; this.zIndex = 0; this._ec = []; this.flag = false; this.selected = false; SQL.Visual.apply(this); this.data.comment = ""; this.setTitle(name); this.x = x || 0; this.y = y || 0; this.setZ(z); this.snap(); } SQL.Table.prototype = Object.create(SQL.Visual.prototype); SQL.Table.prototype._build = function() { this.dom.container = OZ.DOM.elm("div", {className:"table"}); this.dom.content = OZ.DOM.elm("table"); var thead = OZ.DOM.elm("thead"); var tr = OZ.DOM.elm("tr"); this.dom.title = OZ.DOM.elm("td", {className:"title", colSpan:2}); OZ.DOM.append( [this.dom.container, this.dom.content], [this.dom.content, thead], [thead, tr], [tr, this.dom.title] ); this.dom.mini = OZ.DOM.elm("div", {className:"mini"}); this.owner.map.dom.container.appendChild(this.dom.mini); this._ec.push(OZ.Event.add(this.dom.container, "click", this.click.bind(this))); this._ec.push(OZ.Event.add(this.dom.container, "dblclick", this.dblclick.bind(this))); this._ec.push(OZ.Event.add(this.dom.container, "mousedown", this.down.bind(this))); this._ec.push(OZ.Event.add(this.dom.container, "touchstart", this.down.bind(this))); this._ec.push(OZ.Event.add(this.dom.container, "touchmove", OZ.Event.prevent)); } SQL.Table.prototype.setTitle = function(t) { var old = this.getTitle(); for (var i=0;i\n'; for (var i=0;i\n"; } xml += "\n"; return xml; } SQL.Table.prototype.fromXML = function(node) { var name = node.getAttribute("name"); this.setTitle(name); var x = parseInt(node.getAttribute("x")) || 0; var y = parseInt(node.getAttribute("y")) || 0; this.moveTo(x, y); var rows = node.getElementsByTagName("row"); for (var i=0;i 1) { return; } var event = e.touches[0]; } else { var event = e; } for (var i=0;i