Skip to content

Commit

Permalink
Foundation for supporting image formats other than PNG (e.g. SVG). Un…
Browse files Browse the repository at this point in the history
…fortunately SVG isn't quite ready for prime time yet.
  • Loading branch information
johncurrier committed Feb 10, 2011
1 parent 3b9e48d commit 7e435d7
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 21 deletions.
4 changes: 4 additions & 0 deletions dist/releaseNotes.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ <h3><a href='http://schemaspy.sourceforge.net'>SchemaSpy</a> Release Notes</h3>

<li class='release'>x.x.x - xx/xx/xxxx - Subversion revision 596
<ul>
<li>Foundation for supporting image formats other than PNG (e.g. SVG).
Unfortunately SVG isn't quite ready for prime time yet.
rev 625
</li>
<li>Added an optional <code>short_column_type</code> to
<code>selectColumnTypesSql</code> to simplify the generated ER diagrams.
Otherwise they could become extremely large.
Expand Down
2 changes: 1 addition & 1 deletion src/net/sourceforge/schemaspy/view/HtmlOrphansPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public boolean write(Database db, List<Table> orphanTables, File diagramDir, Lin
String dotBaseFilespec = table.getName();

File dotFile = new File(diagramDir, dotBaseFilespec + ".1degree.dot");
File imgFile = new File(diagramDir, dotBaseFilespec + ".1degree.png");
File imgFile = new File(diagramDir, dotBaseFilespec + ".1degree." + dot.getFormat());

LineWriter dotOut = new LineWriter(dotFile, Config.DOT_CHARSET);
DotFormatter.getInstance().writeOrphan(table, dotOut);
Expand Down
18 changes: 9 additions & 9 deletions src/net/sourceforge/schemaspy/view/HtmlRelationshipsPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@ public static HtmlRelationshipsPage getInstance() {
}

public boolean write(Database db, File diagramDir, String dotBaseFilespec, boolean hasOrphans, boolean hasRealRelationships, boolean hasImpliedRelationships, Set<TableColumn> excludedColumns, LineWriter html) {
File compactRelationshipsDotFile = new File(diagramDir, dotBaseFilespec + ".real.compact.dot");
File compactRelationshipsDiagramFile = new File(diagramDir, dotBaseFilespec + ".real.compact.png");
File largeRelationshipsDotFile = new File(diagramDir, dotBaseFilespec + ".real.large.dot");
File largeRelationshipsDiagramFile = new File(diagramDir, dotBaseFilespec + ".real.large.png");
File compactImpliedDotFile = new File(diagramDir, dotBaseFilespec + ".implied.compact.dot");
File compactImpliedDiagramFile = new File(diagramDir, dotBaseFilespec + ".implied.compact.png");
File largeImpliedDotFile = new File(diagramDir, dotBaseFilespec + ".implied.large.dot");
File largeImpliedDiagramFile = new File(diagramDir, dotBaseFilespec + ".implied.large.png");

try {
Dot dot = getDot();
if (dot == null) {
Expand All @@ -73,6 +64,15 @@ public boolean write(Database db, File diagramDir, String dotBaseFilespec, boole
return false;
}

File compactRelationshipsDotFile = new File(diagramDir, dotBaseFilespec + ".real.compact.dot");
File compactRelationshipsDiagramFile = new File(diagramDir, dotBaseFilespec + ".real.compact." + dot.getFormat());
File largeRelationshipsDotFile = new File(diagramDir, dotBaseFilespec + ".real.large.dot");
File largeRelationshipsDiagramFile = new File(diagramDir, dotBaseFilespec + ".real.large." + dot.getFormat());
File compactImpliedDotFile = new File(diagramDir, dotBaseFilespec + ".implied.compact.dot");
File compactImpliedDiagramFile = new File(diagramDir, dotBaseFilespec + ".implied.compact." + dot.getFormat());
File largeImpliedDotFile = new File(diagramDir, dotBaseFilespec + ".implied.large.dot");
File largeImpliedDiagramFile = new File(diagramDir, dotBaseFilespec + ".implied.large." + dot.getFormat());

writeHeader(db, "All Relationships", hasOrphans, hasRealRelationships, hasImpliedRelationships, html);
html.writeln("<table width=\"100%\"><tr><td class=\"container\">");

Expand Down
14 changes: 7 additions & 7 deletions src/net/sourceforge/schemaspy/view/HtmlTableDiagrammer.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ public static HtmlTableDiagrammer getInstance() {
}

public boolean write(Table table, File diagramDir, LineWriter html) {
File oneDegreeDotFile = new File(diagramDir, table.getName() + ".1degree.dot");
File oneDegreeDiagramFile = new File(diagramDir, table.getName() + ".1degree.png");
File twoDegreesDotFile = new File(diagramDir, table.getName() + ".2degrees.dot");
File twoDegreesDiagramFile = new File(diagramDir, table.getName() + ".2degrees.png");
File impliedDotFile = new File(diagramDir, table.getName() + ".implied2degrees.dot");
File impliedDiagramFile = new File(diagramDir, table.getName() + ".implied2degrees.png");

try {
Dot dot = getDot();
if (dot == null)
return false;

File oneDegreeDotFile = new File(diagramDir, table.getName() + ".1degree.dot");
File oneDegreeDiagramFile = new File(diagramDir, table.getName() + ".1degree." + dot.getFormat());
File twoDegreesDotFile = new File(diagramDir, table.getName() + ".2degrees.dot");
File twoDegreesDiagramFile = new File(diagramDir, table.getName() + ".2degrees." + dot.getFormat());
File impliedDotFile = new File(diagramDir, table.getName() + ".implied2degrees.dot");
File impliedDiagramFile = new File(diagramDir, table.getName() + ".implied2degrees." + dot.getFormat());

String map = dot.generateDiagram(oneDegreeDotFile, oneDegreeDiagramFile);

html.write("<br><form action='get'><b>Close relationships");
Expand Down
12 changes: 8 additions & 4 deletions src/net/sourceforge/schemaspy/view/HtmlTablePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import net.sourceforge.schemaspy.model.TableIndex;
import net.sourceforge.schemaspy.model.View;
import net.sourceforge.schemaspy.util.CaseInsensitiveMap;
import net.sourceforge.schemaspy.util.Dot;
import net.sourceforge.schemaspy.util.HtmlEncoder;
import net.sourceforge.schemaspy.util.LineWriter;

Expand Down Expand Up @@ -463,7 +464,7 @@ private void writeView(Table table, Database db, LineWriter out) throws IOExcept
*
* Generates a <TABLENAME>.dot if the table has real relatives.
*
* Also generates a <TABLENAME>..implied2degrees.dot if the table has implied relatives within
* Also generates a <TABLENAME>.implied2degrees.dot if the table has implied relatives within
* two degrees of separation.
*
* @param table Table
Expand All @@ -473,12 +474,15 @@ private void writeView(Table table, Database db, LineWriter out) throws IOExcept
* degrees of separation.
*/
private boolean generateDots(Table table, File diagramDir, WriteStats stats) throws IOException {
Dot dot = Dot.getInstance();
String extension = dot == null ? "png" : dot.getFormat();

File oneDegreeDotFile = new File(diagramDir, table.getName() + ".1degree.dot");
File oneDegreeDiagramFile = new File(diagramDir, table.getName() + ".1degree.png");
File oneDegreeDiagramFile = new File(diagramDir, table.getName() + ".1degree." + extension);
File twoDegreesDotFile = new File(diagramDir, table.getName() + ".2degrees.dot");
File twoDegreesDiagramFile = new File(diagramDir, table.getName() + ".2degrees.png");
File twoDegreesDiagramFile = new File(diagramDir, table.getName() + ".2degrees." + extension);
File impliedDotFile = new File(diagramDir, table.getName() + ".implied2degrees.dot");
File impliedDiagramFile = new File(diagramDir, table.getName() + ".implied2degrees.png");
File impliedDiagramFile = new File(diagramDir, table.getName() + ".implied2degrees." + extension);

// delete before we start because we'll use the existence of these files to determine
// if they should be turned into pngs & presented
Expand Down

0 comments on commit 7e435d7

Please sign in to comment.