diff --git a/extra/jheidi/helpDialog$mysql.ajl b/extra/jheidi/helpDialog$mysql.ajl index 60e03c80..4bdaac5f 100644 --- a/extra/jheidi/helpDialog$mysql.ajl +++ b/extra/jheidi/helpDialog$mysql.ajl @@ -54,7 +54,7 @@ args().put("windowContext", context); - script("initHelpTree", args()); + script("initHelpTreeMySQL", args()); dlg.visible(); diff --git a/extra/jheidi/initHelpTreeMySQL.ajl b/extra/jheidi/initHelpTreeMySQL.ajl new file mode 100644 index 00000000..6540f1ea --- /dev/null +++ b/extra/jheidi/initHelpTreeMySQL.ajl @@ -0,0 +1,79 @@ + import java.util.List; + + WindowContext context = argObj("windowContext"); + HashObject profile = context.get("profile"); + Tree tree = context.get("/helpTree"); + final NodeInfo root = (NodeInfo)tree.getModel().getRoot(); + + tree.setCellRenderer(new IconicCellRenderer("images/helptopic.gif", "images/helpitem.gif")); + + final DB db = context.get("db"); + + DB.AutoCleanupTX tx = new DB.AutoCleanupTX() { + public void execute() throws Exception { + List curItems = db.execute("help contents"); + NodeInfo curNode = root; + + Stack stack = new Stack(); + HashObject pointer = new HashObject(); + pointer.put("node", curNode); + pointer.put("items", curItems); + stack.push(pointer); + + while (!stack.empty()) + { + pointer = stack.pop(); + curItems = pointer.getObject("items"); + curNode = pointer.getObject("node"); + + for ( HashObject item: curItems) + { + if ( "Y".equals(item.get("is_it_category"))) + { + NodeInfo branch = new NodeInfo(item.get("name")); + //this if statement is needed because of bugs in some mysql help tables + //causing infinite recursion. lazier loading in jheidi would also work. + if ( !branch.getText().equals(curNode.getText())) + { + branch.setType("helptopic"); + branch.setIcon("helptopic"); + HashObject newPointer = new HashObject(); + newPointer.put("items", db.execute("help '" + item.get("name") + "'")); + newPointer.put("node", branch); + curNode.add(branch); + stack.push(newPointer); + } + } + else + { + NodeInfo leaf = new NodeInfo(item.get("name")); + leaf.setType("helpitem"); + leaf.setIcon("helpitem"); + curNode.add(leaf); + } + } + + } + } + }; + + db.execute(tx); + + tree.updateUI(); + + + + + + + + + + + + + + + + + diff --git a/extra/jheidi/initHelpTreeOracle.ajl b/extra/jheidi/initHelpTreeOracle.ajl new file mode 100644 index 00000000..122f1772 --- /dev/null +++ b/extra/jheidi/initHelpTreeOracle.ajl @@ -0,0 +1,79 @@ + import java.util.List; + + WindowContext context = argObj("windowContext"); + HashObject profile = context.get("profile"); + Tree tree = context.get("/helpTree"); + final NodeInfo root = (NodeInfo)tree.getModel().getRoot(); + + tree.setCellRenderer(new IconicCellRenderer("images/helptopic.gif", "images/helpitem.gif")); + + final DB db = context.get("db"); + + DB.AutoCleanupTX tx = new DB.AutoCleanupTX() { + public void execute() throws Exception { + List curItems = db.execute("select info as name, 'N' as is_it_category from system.help where topic='TOPICS' and info<>'MENU' and info<>'INDEX' and info <> 'TOPICS' and info is not null and info not like ' Help%' order by seq"); + NodeInfo curNode = root; + + Stack stack = new Stack(); + HashObject pointer = new HashObject(); + pointer.put("node", curNode); + pointer.put("items", curItems); + stack.push(pointer); + + while (!stack.empty()) + { + pointer = stack.pop(); + curItems = pointer.getObject("items"); + curNode = pointer.getObject("node"); + + for ( HashObject item: curItems) + { + if ( "Y".equals(item.get("is_it_category"))) + { + NodeInfo branch = new NodeInfo(item.get("name")); + //this if statement is needed because of bugs in some mysql help tables + //causing infinite recursion. lazier loading in jheidi would also work. + if ( !branch.getText().equals(curNode.getText())) + { + branch.setType("helptopic"); + branch.setIcon("helptopic"); + HashObject newPointer = new HashObject(); + newPointer.put("items", db.execute("help '" + item.get("name") + "'")); + newPointer.put("node", branch); + curNode.add(branch); + stack.push(newPointer); + } + } + else + { + NodeInfo leaf = new NodeInfo(item.get("name")); + leaf.setType("helpitem"); + leaf.setIcon("helpitem"); + curNode.add(leaf); + } + } + + } + } + }; + + db.execute(tx); + + tree.updateUI(); + + + + + + + + + + + + + + + + +