Skip to content

Commit

Permalink
Tab-based layout
Browse files Browse the repository at this point in the history
  • Loading branch information
johncurrier committed Oct 31, 2005
1 parent e98d56e commit 09b9a3d
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 93 deletions.
77 changes: 16 additions & 61 deletions src/net/sourceforge/schemaspy/view/HtmlFormatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ protected void writeHeader(Database db, Table table, String text, boolean showRe
out.writeln("</head>");
out.writeln("<body onload='syncOptions()'>");
writeTableOfContents(showRelationships, showOrphans, out);
out.writeln("<div class='content'>");
out.writeln("<table width='100%' border='0' cellpadding='0'>");
out.writeln(" <tr>");
out.write(" <td class='heading' valign='top'><h1>");
if (table == null)
out.write("SchemaSpy Analysis of ");
out.write(getDescription(db, table, text, true));
out.writeln("</h1></td>");
out.writeln(" <td class='heading' align='right' valign='top' title='John Currier - Creator of Cool Tools'>Generated by<br><span class='signature'><a href='http://schemaspy.sourceforge.net' target='_blank'>SchemaSpy</a></span></td>");
out.writeln(" <td class='heading' align='right' valign='top' title='John Currier - Creator of Cool Tools'><span class='indent'>Generated by</span><br><span class='indent'><span class='signature'><a href='http://schemaspy.sourceforge.net' target='_blank'>SchemaSpy</a></span></span></td>");
out.writeln(" </tr>");
out.writeln("</table>");
}
Expand All @@ -43,62 +44,15 @@ protected void writeGeneratedBy(Database db, LineWriter html) throws IOException

protected void writeTableOfContents(boolean showRelationships, boolean showOrphans, LineWriter html) throws IOException {
String path = getPathToRoot();
html.writeln("<table class='menu' cellpadding='0' cellspacing='1' width='100%'>");
html.writeln(" <tr>");
if (!isMainIndex())
html.writeln(" <td><a class='menuitem' href='" + path + "index.html'>Tables</a></td>");
else
html.writeln(" <td class='selectedMenuitem'>Tables</td>");
if (showRelationships)
html.writeln(" <td><a class='menuitem' href='" + path + "relationships.html' title='Graphical view of table relationships'>Relationships</a></td>");
else
html.writeln(" <td class='selectedMenuitem'>Relationships</td>");
if (showOrphans)
html.writeln(" <td><a class='menuitem' href='" + path + "utilities.html' title='Graphical view of tables with neither parents nor children'>Utility&nbsp;Tables</a></td>");
else
html.writeln(" <td class='selectedMenuitem'>Utility&nbsp;Tables</td>");
if (!isConstraintsPage())
html.writeln(" <td><a class='menuitem' href='" + path + "constraints.html' title='Useful for diagnosing error messages that just give constraint name or number'>Constraints</a></td>");
else
html.writeln(" <td class='selectedMenuitem'>Constraints</td>");
if (!isAnomaliesPage())
html.writeln(" <td><a class='menuitem' href='" + path + "anomalies.html' title=\"Things that aren't quite right\">Anomalies</a></td>");
else
html.writeln(" <td class='selectedMenuitem'>Anomalies</td>");
if (!isColumnsPage())
html.writeln(" <td><a class='menuitem' href='" + path + "columns.html' title=\"All of the columns in the schema\">Columns</a></td>");
else
html.writeln(" <td class='selectedMenuitem'>Columns</td>");
html.writeln(" <td><a class='menuitem' href='http://sourceforge.net/donate/index.php?group_id=137197'>Donate</a></td>");
html.writeln(" </tr>");
html.writeln("</table>");


/**
html.writeln("<table width='100%'>");
html.writeln(" <tr>");
html.writeln(" <td class='container'>");
html.write(" ");
if (!isMainIndex())
html.write("<a href='" + path + "index.html'>Tables</a>&nbsp;&nbsp;");
if (showRelationships)
html.write("<a href='" + path + "relationships.html' title='Graphical view of table relationships'>Relationships</a>&nbsp;&nbsp;");
if (showOrphans)
html.write("<a href='" + path + "utilities.html' title='Graphical view of tables with neither parents nor children'>Utility Tables</a>&nbsp;&nbsp;");
if (!isConstraintsPage())
html.write("<a href='" + path + "constraints.html' title='Useful for diagnosing error messages that just give constraint name or number'>Constraints</a>&nbsp;&nbsp;");
if (!isAnomaliesPage())
html.write("<a href='" + path + "anomalies.html' title=\"Things that aren't quite right\">Anomalies</a>&nbsp;&nbsp;");
if (!isColumnsPage())
html.write("<a href='" + path + "columns.html' title=\"All of the columns in the schema\">Columns</a>");
html.writeln();
html.writeln(" </td>");
showLogo = showLogo && sourceForgeLogoEnabled();
if (showLogo)
html.writeln(" <td class='container' align='right' valign='top'><a href='http://sourceforge.net' target='_blank'><img src='http://sourceforge.net/sflogo.php?group_id=137197&amp;type=1' alt='SourceForge.net' border='0' height='31' width='88'></a></td>");
html.writeln(" </tr>");
html.writeln("</table>");
*/
html.writeln("<ul id='tabmenu'>");
html.writeln(" <li><a " + (isMainIndex() ? "class='active'" : "") + " href='" + path + "index.html' title='All tables and views in the schema'>Tables</a></li>");
html.writeln(" <li><a " + (!showRelationships ? "class='active'" : "") + " href='" + path + "relationships.html' title='Graphical view of table relationships'>Relationships</a></li>");
html.writeln(" <li><a " + (!showOrphans ? "class='active'" : "") + " href='" + path + "utilities.html' title='Graphical view of tables with neither parents nor children'>Utility&nbsp;Tables</a></li>");
html.writeln(" <li><a " + (isConstraintsPage() ? "class='active'" : "") + " href='" + path + "constraints.html' title='Useful for diagnosing error messages that just give constraint name or number'>Constraints</a></li>");
html.writeln(" <li><a " + (isAnomaliesPage() ? "class='active'" : "") + " href='" + path + "anomalies.html' title=\"Things that aren't quite right\">Anomalies</a></li>");
html.writeln(" <li><a " + (isColumnsPage() ? "class='active'" : "") + " href='" + path + "columns.html' title=\"All of the columns in the schema\">Columns</a></li>");
html.writeln(" <li><a href='http://sourceforge.net/donate/index.php?group_id=137197' title='Please help keep SchemaSpy going' target='_blank'>Donate</a></li>");
html.writeln("</ul>");
}

protected String getDescription(Database db, Table table, String text, boolean hoverHelp) {
Expand Down Expand Up @@ -176,7 +130,7 @@ protected void writeLegend(boolean tableDetails, boolean graphDetails, LineWrite
}

protected void writeFeedMe(LineWriter html) throws IOException {
html.write("Please <a href='http://sourceforge.net/donate/index.php?group_id=137197' target='_blank'>support</a> this project");
html.write("Please <a href='http://sourceforge.net/donate/index.php?group_id=137197' target='_blank' title='Please help keep SchemaSpy going'>support</a> this project");
}

protected void writeExcludedColumns(Set excludedColumns, LineWriter html) throws IOException {
Expand All @@ -199,9 +153,10 @@ protected void writeExcludedColumns(Set excludedColumns, LineWriter html) throws
}


protected void writeFooter(LineWriter out) throws IOException {
out.writeln("</body>");
out.writeln("</html>");
protected void writeFooter(LineWriter html) throws IOException {
html.writeln("</div>");
html.writeln("</body>");
html.writeln("</html>");
}

/**
Expand Down
25 changes: 17 additions & 8 deletions src/net/sourceforge/schemaspy/view/StyleSheet.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ private StyleSheet(BufferedReader cssReader) throws IOException {
String line;

while ((line = cssReader.readLine()) != null) {
int slashes = line.indexOf("//");
if (slashes != -1)
line = line.substring(0, slashes);
data.append(line);
data.append(lineSeparator);
}
Expand All @@ -44,8 +47,8 @@ private StyleSheet(BufferedReader cssReader) throws IOException {
ids.add(id);
} else {
Map attribs = parseAttributes(token);
if (id.equals("body"))
bodyBackgroundColor = attribs.get("background-color").toString();
if (id.equals(".content"))
bodyBackgroundColor = attribs.get("background").toString();
else if (id.equals("th"))
tableHeadBackgroundColor = attribs.get("background-color").toString();
else if (id.equals("td"))
Expand Down Expand Up @@ -73,12 +76,18 @@ public static void init(BufferedReader cssReader) throws IOException {

private Map parseAttributes(String data) {
Map attribs = new HashMap();
StringTokenizer attrTokenizer = new StringTokenizer(data, ";");
while (attrTokenizer.hasMoreTokens()) {
StringTokenizer pairTokenizer = new StringTokenizer(attrTokenizer.nextToken(), ":");
String attribute = pairTokenizer.nextToken().trim().toLowerCase();
String value = pairTokenizer.nextToken().trim().toLowerCase();
attribs.put(attribute, value);

try {
StringTokenizer attrTokenizer = new StringTokenizer(data, ";");
while (attrTokenizer.hasMoreTokens()) {
StringTokenizer pairTokenizer = new StringTokenizer(attrTokenizer.nextToken(), ":");
String attribute = pairTokenizer.nextToken().trim().toLowerCase();
String value = pairTokenizer.nextToken().trim().toLowerCase();
attribs.put(attribute, value);
}
} catch (NoSuchElementException badToken) {
System.err.println("Failed to extract attributes from '" + data + "'");
throw badToken;
}

return attribs;
Expand Down
74 changes: 50 additions & 24 deletions src/schemaSpy.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* background-color must be specified for body to propagate into graphs */
body {
color: #000000;
background-color: #F7F7F7;
background-color: #BED1B8;
font-family: arial, geneva, helvetica, sans-serif;
}

Expand All @@ -23,6 +23,15 @@ h1 {
font-size: 125%;
}

/* background must be specified for it to propagate into graphs */
.content {
background: #F7F7F7;
padding: 2px;
border: 2px solid black;
border-top: none;
z-index: 2;
}

/* background must be specified for .primaryKey to propagate into graphs */
.primaryKey {
background: #BED1B8;
Expand Down Expand Up @@ -111,6 +120,10 @@ table {
.degrees {
}

.indent {
padding: 2px;
}

a:link {
color: #489148;
}
Expand All @@ -119,36 +132,49 @@ a:visited {
color: #183118;
}

.menu {
border-width: 1px;
border-style: solid;
border-color: #CCCCCC;
padding : 1px;
margin : 1px;
background-color: #E7E7E7
#tabmenu {
color: #000000;
border-bottom: 2px solid black;
margin: 10px 0px 0px 0px;
padding: 0px;
z-index: 1;
padding-left: 8px
}

.menuitem {
font-size: 85%;
display: block;
color: #000000;
margin-top: 1px;
padding: 1px;
background-color: #E7E7E7;
border: 1px solid #dddddd;
text-align: center;
#tabmenu li {
display: inline;
overflow: hidden;
list-style-type: none;
}

.menuitem:hover {
#tabmenu a, a.active {
color: #DEDECF;
background: #9BAB96;
color: #ffffff;
border-color: #ffffff;
font: 1em Arial, sans-serif;
border: 2px solid black;
padding: 2px 5px 1px 5px;
margin: 0px;
text-decoration: none;
}

.selectedMenuitem {
font-size: 85%;
#tabmenu a.active {
color: #000000;
background: #F7F7F7;
font: Bold 1em Arial, sans-serif;
border-bottom: 2px solid #F7F7F7;
margin: 1px;
}

#tabmenu a:hover {
color: #FFFFFF;
background: #ADC09F;
}

#tabmenu a {
color: #F4F7DA;
}

#tabmenu a.active:hover {
background: #F7F7F7;
color: #000000;
background-color: #E7E7E7;
text-align: center;
}

0 comments on commit 09b9a3d

Please sign in to comment.