diff --git a/src/net/sourceforge/schemaspy/view/HtmlGraphFormatter.java b/src/net/sourceforge/schemaspy/view/HtmlGraphFormatter.java index 4962b2b..a7bd405 100755 --- a/src/net/sourceforge/schemaspy/view/HtmlGraphFormatter.java +++ b/src/net/sourceforge/schemaspy/view/HtmlGraphFormatter.java @@ -78,24 +78,37 @@ public boolean write(Table table, File graphDir, WriteStats stats, LineWriter ht } public boolean write(Database db, File graphDir, String dotBaseFilespec, boolean hasOrphans, boolean hasImpliedRelationships, LineWriter html) throws IOException { - File relationshipsDotFile = new File(graphDir, dotBaseFilespec + ".real.dot"); - File relationshipsGraphFile = new File(graphDir, dotBaseFilespec + ".real.png"); - File impliedDotFile = new File(graphDir, dotBaseFilespec + ".implied.dot"); - File impliedGraphFile = new File(graphDir, dotBaseFilespec + ".implied.png"); + File compactRelationshipsDotFile = new File(graphDir, dotBaseFilespec + ".real.compact.dot"); + File compactRelationshipsGraphFile = new File(graphDir, dotBaseFilespec + ".real.compact.png"); + File largeRelationshipsDotFile = new File(graphDir, dotBaseFilespec + ".real.large.dot"); + File largeRelationshipsGraphFile = new File(graphDir, dotBaseFilespec + ".real.large.png"); + File compactImpliedDotFile = new File(graphDir, dotBaseFilespec + ".implied.compact.dot"); + File compactImpliedGraphFile = new File(graphDir, dotBaseFilespec + ".implied.compact.png"); + File largeImpliedDotFile = new File(graphDir, dotBaseFilespec + ".implied.large.dot"); + File largeImpliedGraphFile = new File(graphDir, dotBaseFilespec + ".implied.large.png"); try { Dot dot = getDot(); if (dot == null) return false; - dot.generateGraph(relationshipsDotFile, relationshipsGraphFile); - writeRelationshipsHeader(db, relationshipsGraphFile, impliedGraphFile, "Relationships Graph", hasOrphans, hasImpliedRelationships, html); - html.writeln(" "); - dot.writeMap(relationshipsDotFile, html); + dot.generateGraph(compactRelationshipsDotFile, compactRelationshipsGraphFile); + System.out.print("."); + dot.generateGraph(largeRelationshipsDotFile, largeRelationshipsGraphFile); + System.out.print("."); + writeRelationshipsHeader(db, compactRelationshipsGraphFile, largeRelationshipsGraphFile, compactImpliedGraphFile, largeImpliedGraphFile, "Relationships Graph", hasOrphans, hasImpliedRelationships, html); + html.writeln(" "); + dot.writeMap(compactRelationshipsDotFile, html); + dot.writeMap(largeRelationshipsDotFile, html); if (hasImpliedRelationships) { - dot.generateGraph(impliedDotFile, impliedGraphFile); - dot.writeMap(impliedDotFile, html); + dot.generateGraph(compactImpliedDotFile, compactImpliedGraphFile); + dot.writeMap(compactImpliedDotFile, html); + System.out.print("."); + + dot.generateGraph(largeImpliedDotFile, largeImpliedGraphFile); + dot.writeMap(largeImpliedDotFile, html); + System.out.print("."); } writeFooter(html); @@ -164,7 +177,7 @@ public boolean writeOrphans(Database db, List orphanTables, boolean hasRelations } } - private void writeRelationshipsHeader(Database db, File relationshipsGraphFile, File impliedGraphFile, String title, boolean hasOrphans, boolean hasImpliedRelationships, LineWriter html) throws IOException { + private void writeRelationshipsHeader(Database db, File compactRelationshipsGraphFile, File largeRelationshipsGraphFile, File compactImpliedGraphFile, File largeImpliedGraphFile, String title, boolean hasOrphans, boolean hasImpliedRelationships, LineWriter html) throws IOException { writeHeader(db, null, title, html); html.writeln("
"); html.write("
Tables  "); @@ -173,17 +186,43 @@ private void writeRelationshipsHeader(Database db, File relationshipsGraphFile, html.write("Constraints  "); html.writeln("Anomalies"); + // this is some UGLY code! + html.writeln("

"); + html.write(" "); - html.write(" "); + } + html.write(" selectGraph('graphs/summary/" + compactRelationshipsGraphFile.getName() + "', '#compactRelationshipsGraph'); "); + html.write("} else {"); + if (hasImpliedRelationships) { + html.write(" if (document.options.implied.checked) "); + html.write(" selectGraph('graphs/summary/" + largeImpliedGraphFile.getName() + "', '#largeImpliedRelationshipsGraph'); "); + html.write(" else"); + } + html.write(" selectGraph('graphs/summary/" + largeRelationshipsGraphFile.getName() + "', '#largeRelationshipsGraph'); "); + html.write("}\">"); + html.writeln("Compact"); + + // more butt-ugly 'code' follows + if (hasImpliedRelationships) { + html.write(" "); html.writeln("Include implied relationships"); - html.writeln("
"); } + html.writeln(""); html.writeln("
"); writeLegend(false, html); diff --git a/src/net/sourceforge/schemaspy/view/JavaScriptFormatter.java b/src/net/sourceforge/schemaspy/view/JavaScriptFormatter.java index fcfa253..509d5ad 100755 --- a/src/net/sourceforge/schemaspy/view/JavaScriptFormatter.java +++ b/src/net/sourceforge/schemaspy/view/JavaScriptFormatter.java @@ -40,7 +40,12 @@ public static void write(LineWriter out) throws IOException { out.writeln(" cb.checked=true;"); out.writeln(" cb.click();"); out.writeln(" }"); - out.writeln(" cb = options.graphType;"); + out.writeln(" cb = options.compact;"); + out.writeln(" if (cb && !cb.checked) {"); + out.writeln(" cb.checked=true;"); + out.writeln(" cb.click();"); + out.writeln(" }"); + out.writeln(" cb = options.implied;"); out.writeln(" if (cb && cb.checked) {"); out.writeln(" cb.checked=false;"); out.writeln(" cb.click();");