org.h2.server.web.res.tree.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of h2-mvstore Show documentation
Show all versions of h2-mvstore Show documentation
Fork of h2database to maintain Java 8 compatibility
The newest version!
/*
* Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0,
* and the EPL 1.0 (https://h2database.com/html/license.html).
* * Initial Developer: H2 Group
*/
var nodeList = new Array();
var icons = new Array();
var tables = new Array();
var tablesByName = new Object();
function Table(name, columns, i) {
this.name = name;
this.columns = columns;
this.id = i;
}
function addTable(name, columns, i) {
var t = new Table(name, columns, i);
tables[tables.length] = t;
tablesByName[name] = t;
}
function ins(s, isTable) {
if (parent.h2query) {
if (parent.h2query.insertText) {
parent.h2query.insertText(s, isTable);
}
}
}
function refreshQueryTables() {
if (parent.h2query) {
if (parent.h2query.refreshTables) {
parent.h2query.refreshTables();
}
}
}
function goToTable(s) {
var t = tablesByName[s];
if (t) {
hitOpen(t.id);
return true;
}
return false;
}
function loadIcons() {
icons[0] = new Image();
icons[0].src = "tree_minus.gif";
icons[1] = new Image();
icons[1].src = "tree_plus.gif";
}
function Node(level, type, icon, text, link) {
this.level = level;
this.type = type;
this.icon = icon;
this.text = text;
this.link = link;
}
function setNode(id, level, type, icon, text, link) {
nodeList[id] = new Node(level, type, icon, text, link);
}
function writeDiv(i, level, dist) {
if (dist>0) {
document.write("");
} else {
while (dist++<0) {
document.write("");
}
}
}
function writeTree() {
loadIcons();
var last=nodeList[0];
for (var i=0; i0) {
document.write("");
}
if (node.type==1) {
if (i < nodeList.length-1 && nodeList[i+1].level > node.level) {
document.write("");
} else {
document.write("");
}
}
document.write(" ");
if (node.link==null) {
document.write(node.text);
} else {
document.write(""+node.text+"");
}
document.write("
");
}
writeDiv(0, 0, -last.type);
}
function hit(i) {
var theDiv = document.getElementById("div"+i);
var theJoin = document.getElementById("join"+i);
if (theDiv.style.display == 'none') {
theJoin.src = icons[0].src;
theDiv.style.display = '';
} else {
theJoin.src = icons[1].src;
theDiv.style.display = 'none';
}
}
function hitOpen(i) {
var theDiv = document.getElementById("div"+i);
var theJoin = document.getElementById("join"+i);
theJoin.src = icons[0].src;
theDiv.style.display = '';
}