Skip to content

Commit

Permalink
try to reduce codebeat warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dickschoeller committed Apr 1, 2017
1 parent 3d4bcf8 commit 8cd07c3
Showing 1 changed file with 38 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,43 +58,22 @@ default String getSeparator(final boolean separate) {
* @return a string containing the HTML header.
*/
default String getHeaderHtml(final String title, final String keywords) {
final StringBuilder builder = new StringBuilder(585);
builder.append("Content-type: text/html\n\n");
builder.append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\n");
builder.append(" \"http://www.w3.org/TR/html4/strict.dtd\">\n");
builder.append("<html>\n");
builder.append(" <head>\n");
appendMetaTags(keywords, builder);
builder.append(" <link href=\"/gedbrowser/gedbrowser.css\" ");
builder.append("rel=\"stylesheet\" type=\"text/css\">\n");
builder.append(" <title>");
builder.append(title);
builder.append("</title>\n");
builder.append(" </head>\n");
builder.append(" <body>\n");
return builder.toString();
}

/**
* NOT INTENDED FOR OVERRIDE. JUST REDUCING COMPLEXITY.
*
* @param keywords keywords for this page
* @param builder the builder being appended to
*/
default void appendMetaTags(final String keywords,
final StringBuilder builder) {
builder.append(" <meta http-equiv=\"Content-Type\" ");
builder.append("content=\"text/html; charset=utf-8\">\n");
builder.append(" <meta name=\"Author\" ");
builder.append("content=\"gedbrowser\">\n");
builder.append(" <meta name=\"Description\" ");
builder.append("content=\"genealogy\">\n");
builder.append(" <meta name=\"Keywords\" ");
builder.append("content=\"genealogy gedbrowser ");
builder.append(keywords);
builder.append("\">\n");
builder.append(" <meta http-equiv=\"Content-Style-Type\" ");
builder.append("content=\"text/css\">\n");
return "Content-type: text/html\n\n"
+ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\n"
+ " \"http://www.w3.org/TR/html4/strict.dtd\">\n"
+ "<html>\n <head>\n"
+ " <meta http-equiv=\"Content-Type\" "
+ "content=\"text/html; charset=utf-8\">\n"
+ " <meta name=\"Author\" content=\"gedbrowser\">\n"
+ " <meta name=\"Description\" content=\"genealogy\">\n"
+ " <meta name=\"Keywords\" content=\"genealogy gedbrowser "
+ keywords + "\">\n"
+ " <meta http-equiv=\"Content-Style-Type\" "
+ "content=\"text/css\">\n"
+ " <link href=\"/gedbrowser/gedbrowser.css\" "
+ "rel=\"stylesheet\" type=\"text/css\">\n"
+ " <title>" + title + "</title>\n"
+ " </head>\n <body>\n";
}

/**
Expand All @@ -115,63 +94,31 @@ default String getTrailerHtml() {
* @return trailer HTML
*/
default String getTrailerHtml(final String omit) {
final StringBuilder builder = new StringBuilder(1000);
builder.append("\n <hr class=\"final\"/>");
menuInsertions(omit, builder);
builder.append("\n <hr class=\"final\"/>");
builder.append("\n <table class=\"buttonrow\">");
builder.append("\n <tr class=\"buttonrow\">");
builder.append("\n <td class=\"brleft\">");
appendApplicationInfo(builder);
builder.append("\n </td>");
builder.append("\n <td class=\"brright\">");
appendValidator(builder);
builder.append("\n </td>");
builder.append("\n </tr>");
builder.append("\n </table>");
builder.append("\n <p>");
builder.append("\n </body>");
builder.append("\n</html>\n");
return builder.toString();
}

/**
* NOT INTENDED FOR OVERRIDE. JUST REDUCING COMPLEXITY.
*
* @param builder the builder being appended to
*/
default void appendApplicationInfo(final StringBuilder builder) {
final java.util.Date javaDate = new java.util.Date();
final String timeString = DateFormat.getDateInstance(DateFormat.LONG,
Locale.getDefault()).format(javaDate);
builder.append("\n <p class=\"maintainer\">");
builder.append("\n Maintained by <a href=\"mailto:");
builder.append(getMaintainerEmail());
builder.append("\">");
builder.append(getMaintainerName());
builder.append("</a>.<br>");
builder.append("\n Created with <a href=\"");
builder.append(getHomeUrl());
builder.append("software/gedbrowser.html");
builder.append("\">GEDbrowser</a>, version ");
builder.append(getVersion());
builder.append(" on ");
builder.append(timeString);
builder.append("\n </p>");
}

/**
* NOT INTENDED FOR OVERRIDE. JUST REDUCING COMPLEXITY.
*
* @param builder the builder being appended to
*/
default void appendValidator(final StringBuilder builder) {
builder.append("\n <p class=\"maintainer\">");
builder.append("\n<a href=\"http://validator.w3.org/check/referer\">");
builder.append("<img src=\"/gedbrowser/valid-html401.gif\" ");
builder.append("class=\"button\" alt=\"[ Valid HTML 4.01! ]\" ");
builder.append("height=\"31\" width=\"88\"></a>");
builder.append("\n </p>");
final StringBuilder builder = new StringBuilder();
menuInsertions(omit, builder);
final String retVal =
"\n <hr class=\"final\"/>"
+ builder.toString()
+ "\n <hr class=\"final\"/>"
+ "\n <table class=\"buttonrow\">"
+ "\n <tr class=\"buttonrow\">\n <td class=\"brleft\">"
+ "\n <p class=\"maintainer\">\n Maintained by <a href=\"mailto:"
+ getMaintainerEmail() + "\">" + getMaintainerName()
+ "</a>.<br>\n Created with <a href=\"" + getHomeUrl()
+ "software/gedbrowser.html"
+ "\">GEDbrowser</a>, version " + getVersion() + " on " + timeString
+ "\n </p>\n </td>\n <td class=\"brright\">"
+ "\n <p class=\"maintainer\">"
+ "\n<a href=\"http://validator.w3.org/check/referer\">"
+ "<img src=\"/gedbrowser/valid-html401.gif\" "
+ "class=\"button\" alt=\"[ Valid HTML 4.01! ]\" "
+ "height=\"31\" width=\"88\"></a>"
+ "\n </p>\n </td>\n </tr>\n </table>\n <p>\n </body>"
+ "\n</html>\n";
return retVal;
}

/**
Expand Down

0 comments on commit 8cd07c3

Please sign in to comment.