/** * Appends the string representation of the given character array * with a style to the {@link StyledString}. The * appended character array will be styled using the given styler. * * @param chars * the character array to append * @param styler * the styler to use for styling the character array to append or * <code>null</code> if no styler should be associated with the * appended character array * @return returns a reference to this object */ public StyledString append(char[] chars, Styler styler) { if (chars.length == 0) return this; int offset = fBuffer.length(); // the length before appending fBuffer.append(chars); appendStyleRun(styler, offset); return this; }
/** * Appends the string representation of the given character array * with a style to the {@link StyledString}. The * appended character array will be styled using the given styler. * * @param chars * the character array to append * @param styler * the styler to use for styling the character array to append or * <code>null</code> if no styler should be associated with the * appended character array * @return returns a reference to this object */ public StyledString append(char[] chars, Styler styler) { if (chars.length == 0) return this; int offset = fBuffer.length(); // the length before appending fBuffer.append(chars); appendStyleRun(styler, offset); return this; }
/** * Appends a string with a style to the {@link StyledString}. The * appended string will be styled using the given styler. * * @param string * the string to append * @param styler * the styler to use for styling the string to append or * <code>null</code> if no styler should be associated with the * appended string. * @return returns a reference to this object */ public StyledString append(String string, Styler styler) { if (string.length() == 0) return this; int offset = fBuffer.length(); // the length before appending fBuffer.append(string); appendStyleRun(styler, offset); return this; }
/** * Appends a string with a style to the {@link StyledString}. The * appended string will be styled using the given styler. * * @param string * the string to append * @param styler * the styler to use for styling the string to append or * <code>null</code> if no styler should be associated with the * appended string. * @return returns a reference to this object */ public StyledString append(String string, Styler styler) { if (string.length() == 0) return this; int offset = fBuffer.length(); // the length before appending fBuffer.append(string); appendStyleRun(styler, offset); return this; }
/** * Appends a string with styles to the {@link StyledString}. * * @param string * the string to append * @return returns a reference to this object */ public StyledString append(StyledString string) { if (string.length() == 0) { return this; } int offset = fBuffer.length(); fBuffer.append(string.toString()); List otherRuns = string.fStyleRuns; if (otherRuns != null && !otherRuns.isEmpty()) { for (int i = 0; i < otherRuns.size(); i++) { StyleRun curr = (StyleRun) otherRuns.get(i); if (i == 0 && curr.offset != 0) { appendStyleRun(null, offset); // appended string will // start with the default // color } appendStyleRun(curr.style, offset + curr.offset); } } else { appendStyleRun(null, offset); // appended string will start with // the default color } return this; }
/** * Appends a string with styles to the {@link StyledString}. * * @param string * the string to append * @return returns a reference to this object */ public StyledString append(StyledString string) { if (string.length() == 0) { return this; } int offset = fBuffer.length(); fBuffer.append(string.toString()); List<StyleRun> otherRuns = string.fStyleRuns; if (otherRuns != null && !otherRuns.isEmpty()) { for (int i = 0; i < otherRuns.size(); i++) { StyleRun curr = otherRuns.get(i); if (i == 0 && curr.offset != 0) { appendStyleRun(null, offset); // appended string will // start with the default // color } appendStyleRun(curr.style, offset + curr.offset); } } else { appendStyleRun(null, offset); // appended string will start with // the default color } return this; }
if (lastRun == null || lastRun.offset <= offset) { Styler lastStyler = lastRun == null ? null : lastRun.style; appendStyleRun(styler, offset); if (offset + length != fBuffer.length()) { appendStyleRun(lastStyler, offset + length);
if (lastRun == null || lastRun.offset <= offset) { Styler lastStyler = lastRun == null ? null : lastRun.style; appendStyleRun(styler, offset); if (offset + length != fBuffer.length()) { appendStyleRun(lastStyler, offset + length);