3 * (C) 2006 by Simo Sorce
10 * Swat LDB Browser class graphical user interface
13 qx.OO.defineClass("swat.module.ldbbrowse.ldifViewer", qx.ui.embed.HtmlEmbed,
16 qx.ui.embed.HtmlEmbed.call(this, "");
18 this.setStyleProperty("whiteSpace", "nowrap");
19 this.setStyleProperty("textOverflow", "ellipsis");
21 this.setOverflow("auto");
22 this.setSelectable(true);
27 //qx.OO.changeProperty({ name : "appearance", type : "string", defaultValue : "???" });
29 qx.OO.addProperty({ name : "innerText", type : "string" });
31 swat.module.ldbbrowse.ldifViewer.empty = {
36 qx.Proto.reset = function() {
41 qx.Proto._update = function() {
42 this.setHtml("<pre>" + this.innerText + "</pre>");
45 qx.Proto.appendComment = function(aText) {
46 this.innerText = this.innerText + "# " + a Text + "\n\n";
50 qx.Proto.appendObject = function(o) {
52 // First print the Object name as comment
53 // TODO: Prettify it later
54 var ldifRecord = "# " + o["dn"] + "\n";
57 ldifRecord = ldifRecord + "dn: " + o["dn"] + "\n";
59 // Now the attributes;
63 // If it's multi-valued (type is an array)...
64 if (typeof(o[field]) == "object")
66 // ... then add each value with same name
68 for (var i = 0; i < a.length; i++)
70 ldifRecord = ldifRecord + field + ": " + a[i] + "\n";
75 ldifRecord = ldifRecord + field + ": " + o[field] + "\n";
79 // Terminate the record with an empty line
80 ldifRecord = ldifRecord + "\n";
82 this.innerText = this.innerText + ldifRecord;