SchemaAlignmentDialog.UILink = function(dialog, link, table, options, parentUINode) { this._dialog = dialog; this._link = link; this._options = options; this._parentUINode = parentUINode; // Make sure target node is there this._link.target = this._link.target || { nodeType: "cell-as-value" } this._tr = table.insertRow(table.rows.length); this._tdMain = this._tr.insertCell(0); this._tdToggle = this._tr.insertCell(1); this._tdDetails = this._tr.insertCell(2); $(this._tdMain).addClass("schema-alignment-link-main").attr("width", "250").addClass("padded"); $(this._tdToggle).addClass("schema-alignment-link-toggle").attr("width", "1%").addClass("padded"); $(this._tdDetails).addClass("schema-alignment-link-details").attr("width", "90%"); this._collapsedDetailDiv = $('
').appendTo(this._tdDetails).addClass("padded").html("..."); this._expandedDetailDiv = $('').appendTo(this._tdDetails).addClass("schema-alignment-detail-container"); var self = this; var show = function() { if (self._options.expanded) { self._collapsedDetailDiv.hide(); self._expandedDetailDiv.show(); } else { self._collapsedDetailDiv.show(); self._expandedDetailDiv.hide(); } }; show(); $(this._tdToggle).html(" "); $('') .attr("src", this._options.expanded ? "images/expanded.png" : "images/collapsed.png") .appendTo(this._tdToggle) .click(function() { self._options.expanded = !self._options.expanded; $(this).attr("src", self._options.expanded ? "images/expanded.png" : "images/collapsed.png"); show(); }); this._renderMain(); this._renderDetails(); }; SchemaAlignmentDialog.UILink.prototype._renderMain = function() { $(this._tdMain).empty(); var label = this._link.property !== null ? this._link.property.id : "property?"; var self = this; $('') .attr("title", "remove property") .attr("src", "images/close.png") .css("cursor", "pointer") .prependTo(this._tdMain) .click(function() { window.setTimeout(function() { self._parentUINode.removeLink(self); self._tr.parentNode.removeChild(self._tr); self._dialog.preview(); }, 100); }); var a = $('') .addClass("schema-alignment-link-tag") .html(label) .appendTo(this._tdMain) .click(function(evt) { self._startEditProperty(this); }); $('').attr("src", "images/arrow-start.png").prependTo(a); $('').attr("src", "images/arrow-end.png").appendTo(a); }; SchemaAlignmentDialog.UILink.prototype._renderDetails = function() { if (this._targetUI) { this._targetUI.dispose(); } if (this._tableDetails) { this._tableDetails.remove(); } this._tableDetails = $('