Skip to content

Commit

Permalink
Now gives a relatively useful relationships page even if dot fails to…
Browse files Browse the repository at this point in the history
… build the larger (and more likely to break Graphviz's dot) images.
  • Loading branch information
johncurrier committed Feb 28, 2006
1 parent dfaef20 commit 430f64c
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions src/net/sourceforge/schemaspy/view/HtmlRelationshipsPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static HtmlRelationshipsPage getInstance() {
return instance;
}

public boolean write(Database db, File graphDir, String dotBaseFilespec, boolean hasOrphans, boolean hasImpliedRelationships, Set excludedColumns, LineWriter html) throws IOException {
public boolean write(Database db, File graphDir, String dotBaseFilespec, boolean hasOrphans, boolean hasImpliedRelationships, Set excludedColumns, LineWriter html) {
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");
Expand All @@ -24,6 +24,7 @@ public boolean write(Database db, File graphDir, String dotBaseFilespec, boolean
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");
boolean somethingFailed = false;

try {
Dot dot = getDot();
Expand All @@ -32,8 +33,13 @@ public boolean write(Database db, File graphDir, String dotBaseFilespec, boolean

dot.generateGraph(compactRelationshipsDotFile, compactRelationshipsGraphFile);
System.out.print(".");
dot.generateGraph(largeRelationshipsDotFile, largeRelationshipsGraphFile);
System.out.print(".");
try {
dot.generateGraph(largeRelationshipsDotFile, largeRelationshipsGraphFile);
System.out.print(".");
} catch (Dot.DotFailure dotFailure) {
System.err.println(dotFailure);
somethingFailed = true;
}
writeHeader(db, compactRelationshipsGraphFile, largeRelationshipsGraphFile, compactImpliedGraphFile, largeImpliedGraphFile, "Relationships Graph", hasOrphans, hasImpliedRelationships, html);
html.writeln("<table width=\"100%\"><tr><td class=\"container\">");
html.writeln(" <a name='graph'><img src='graphs/summary/" + compactRelationshipsGraphFile.getName() + "' usemap='#compactRelationshipsGraph' id='relationships' border='0' alt=''></a>");
Expand All @@ -44,17 +50,32 @@ public boolean write(Database db, File graphDir, String dotBaseFilespec, boolean
dot.writeMap(largeRelationshipsDotFile, html);

if (hasImpliedRelationships) {
dot.generateGraph(compactImpliedDotFile, compactImpliedGraphFile);
dot.writeMap(compactImpliedDotFile, html);
System.out.print(".");

dot.generateGraph(largeImpliedDotFile, largeImpliedGraphFile);
dot.writeMap(largeImpliedDotFile, html);
System.out.print(".");
try {
dot.generateGraph(compactImpliedDotFile, compactImpliedGraphFile);
dot.writeMap(compactImpliedDotFile, html);
System.out.print(".");
} catch (Dot.DotFailure dotFailure) {
System.err.println(dotFailure);
somethingFailed = true;
}

try {
dot.generateGraph(largeImpliedDotFile, largeImpliedGraphFile);
dot.writeMap(largeImpliedDotFile, html);
System.out.print(".");
} catch (Dot.DotFailure dotFailure) {
System.err.println(dotFailure);
somethingFailed = true;
}
}

writeFooter(html);
if (somethingFailed) {
System.out.println();
System.out.println("Relationships page will be incomplete, but hopefully usable.");
}
} catch (Dot.DotFailure dotFailure) {
System.err.println("Failed to create relationships page:");
System.err.println(dotFailure);
return false;
} catch (IOException ioExc) {
Expand Down

0 comments on commit 430f64c

Please sign in to comment.