/** * Renders the specified text width a maximum width. This method differs * from renderWrappedText by not removing leading spaces after a new line. * * @param sb The StringBuilder to place the rendered text into. * @param width The number of characters to display per line * @param nextLineTabStop The position on the next line for the first tab. * @param text The text to be rendered. */ public Appendable renderWrappedTextBlock(StringBuilder sb, int width, int nextLineTabStop, String text) { try { BufferedReader in = new BufferedReader(new StringReader(text)); String line; boolean firstLine = true; while ((line = in.readLine()) != null) { if (!firstLine) { sb.append(getNewLine()); } else { firstLine = false; } renderWrappedText(sb, width, nextLineTabStop, line); } } catch (IOException e) //NOPMD { // cannot happen } return sb; }
sb.append(rtrim(text.substring(0, pos))).append(getNewLine()); sb.append(rtrim(text.substring(0, pos))).append(getNewLine());
sb.append(getNewLine());
sb.append(getNewLine()); sb.append(getNewLine()); sb.append(getNewLine());
/** * Renders the specified text width a maximum width. This method differs * from renderWrappedText by not removing leading spaces after a new line. * * @param sb The StringBuilder to place the rendered text into. * @param width The number of characters to display per line * @param nextLineTabStop The position on the next line for the first tab. * @param text The text to be rendered. */ public Appendable renderWrappedTextBlock(StringBuilder sb, int width, int nextLineTabStop, String text) { try { BufferedReader in = new BufferedReader(new StringReader(text)); String line; boolean firstLine = true; while ((line = in.readLine()) != null) { if (!firstLine) { sb.append(getNewLine()); } else { firstLine = false; } renderWrappedText(sb, width, nextLineTabStop, line); } } catch (IOException e) //NOPMD { // cannot happen } return sb; }
sb.append(getNewLine());
sb.append(rtrim(text.substring(0, pos))).append(getNewLine()); sb.append(rtrim(text.substring(0, pos))).append(getNewLine());
sb.append(getNewLine()); sb.append(getNewLine()); sb.append(getNewLine());