Example usage for javax.servlet.jsp JspWriter newLine

List of usage examples for javax.servlet.jsp JspWriter newLine

Introduction

In this page you can find the example usage for javax.servlet.jsp JspWriter newLine.

Prototype


abstract public void newLine() throws IOException;

Source Link

Document

Write a line separator.

Usage

From source file:fll.web.scoreEntry.ScoreEntry.java

/**
 * Generate the score entry form./*www  .  j a  v a  2 s .  c  o  m*/
 */
public static void generateScoreEntry(final JspWriter writer, final ServletContext application)
        throws IOException {
    final ChallengeDescription description = ApplicationAttributes.getChallengeDescription(application);
    final Formatter formatter = new Formatter(writer);

    String prevCategory = null;
    final PerformanceScoreCategory performanceElement = description.getPerformance();
    for (final AbstractGoal goalEle : performanceElement.getGoals()) {
        final String name = goalEle.getName();
        final String title = goalEle.getTitle();
        final String category = goalEle.getCategory();

        try {

            if (!StringUtils.equals(prevCategory, category)) {
                writer.println("<tr><td colspan='5'>&nbsp;</td></tr>");
                if (!StringUtils.isEmpty(category)) {
                    writer.println("<tr><td colspan='5' class='center'><b>" + category + "</b></td></tr>");
                }
            }

            writer.println("<!-- " + name + " -->");
            writer.println("<tr>");
            writer.println("  <td>");
            writer.println("    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font size='3'><b>" + title + ":</b></font>");
            writer.println("  </td>");

            if (goalEle.isComputed()) {
                writer.println("  <td colspan='2' align='center'><b>Computed Goal</b></td>");
            } else {
                if (goalEle.isEnumerated()) {
                    // enumerated
                    writer.println("  <td>");
                    generateEnumeratedGoalButtons(goalEle, name, writer);
                    writer.println("  </td>");
                } else {
                    writer.println("  <td>");
                    generateSimpleGoalButtons(goalEle, name, writer);
                    writer.println("  </td>");
                } // end simple goal
            } // goal

            // computed score
            writer.println("  <td align='right'>");
            writer.println("    <input type='text' name='score_" + name
                    + "' size='3' align='right' readonly tabindex='-1'>");
            writer.println("  </td>");

            // error message
            formatter.format("  <td class='error score-error' id='error_%s'>&nbsp;</td>%n", name);

            writer.println("</tr>");
            writer.println("<!-- end " + name + " -->");
            writer.newLine();
        } catch (final ParseException pe) {
            throw new RuntimeException("FATAL: min/max not parsable for goal: " + name);
        }

        prevCategory = category;
    } // end foreach child of performance
}