/** * @see org.apache.wicket.request.Response#write(CharSequence) */ @Override public void write(final CharSequence string) { out.append(string); }
/** * @see java.lang.Object#toString() */ @Override public String toString() { AppendingStringBuffer sb = new AppendingStringBuffer().append("Model:classname=[" + getClass().getName() + "]"); sb.append(":nestedModel=[").append(target).append("]"); return sb.toString(); }
private void deleteFragment(AppendingStringBuffer responseBuffer, String prefix, String postfix) { int startIndex, endIndex; if ((startIndex = responseBuffer.indexOf(prefix)) > -1) { if ((endIndex = responseBuffer.indexOf(postfix, startIndex)) > -1) { responseBuffer.delete(startIndex, endIndex + postfix.length()); } } }
/** * {@inheritDoc} */ public AppendingStringBuffer filter(final AppendingStringBuffer responseBuffer) { final int index = responseBuffer.indexOf("</head>"); if (index != -1) { final AppendingStringBuffer script = new AppendingStringBuffer(75); script.append("\n").append(SCRIPT_OPEN_TAG); addJavaScript(script); script.append(";").append(SCRIPT_CLOSE_TAG); responseBuffer.insert(index, script); } return responseBuffer; } }
@Override protected CharSequence getEventHandler() { return new AppendingStringBuffer(super.getEventHandler()).append("; return false;"); }
/** * Constructor */ public StringResponse() { out = new AppendingStringBuffer(128); }
/** * @see java.lang.Object#toString() */ @Override public String toString() { return out.toString(); }
/** * Resets the response to a clean state so it can be reused to save on garbage. */ @Override public void reset() { buffer.clear(); }
/** * Inserts the string representation of the <code>long</code> argument into this string buffer. * <p> * The second argument is converted to a string as if by the method <code>String.valueOf</code>, * and the characters of that string are then inserted into this string buffer at the position * indicated by <code>offset</code>. * <p> * The offset argument must be greater than or equal to <code>0</code>, and less than or equal * to the length of this string buffer. * * @param offset * the offset. * @param l * a <code>long</code>. * @return a reference to this <code>AppendingStringBuffer</code> object. * @exception StringIndexOutOfBoundsException * if the offset is invalid. * @see java.lang.String#valueOf(long) * @see java.lang.StringBuffer#insert(int, java.lang.String) * @see java.lang.StringBuffer#length() */ public AppendingStringBuffer insert(final int offset, final long l) { return insert(offset, String.valueOf(l)); }
public class TitledDropDownChoice<T> extends DropDownChoice<T> { // ... constructors from superclass ... @Override protected void appendOptionHtml(AppendingStringBuffer buffer, T choice, int index, String selected) { super.appendOptionHtml(buffer, choice, index, selected); // converts <option value="foo">bar</option> to // <option value="foo" title="bar">bar</option> String replString = "value=\"" + getChoiceRenderer() .getIdValue(choice, index) + "\""; int pos = buffer.indexOf(replString); buffer.insert(pos + replString.length(), " title=\"" + getChoiceRenderer().getDisplayValue(choice) + "\""); } }
/** * Construct. * * @param url * the {@link AppendingStringBuffer} where to append query string */ public WebRequestEncoder(AppendingStringBuffer url) { if (url.indexOf("?") >= 0) { firstParameter = false; } this.url = url; }
/** * @see org.apache.wicket.util.resource.IResourceStream#length() */ public long length() { return buffer.length(); } }
/** * Called when the validated markup contains errors. * * @param responseBuffer * the validated response markup * @param report * the validation report containing the errors */ protected void onInvalidMarkup(AppendingStringBuffer responseBuffer, ValidationReport report) { String head = report.getHeadMarkup(); String body = report.getBodyMarkup(); int indexOfHeadClose = responseBuffer.lastIndexOf("</head>"); responseBuffer.insert(indexOfHeadClose, head); int indexOfBodyClose = responseBuffer.lastIndexOf("</body>"); responseBuffer.insert(indexOfBodyClose, body); }
/** * {@inheritDoc} */ public AppendingStringBuffer filter(final AppendingStringBuffer responseBuffer) { final int index = responseBuffer.indexOf("</head>"); if (index != -1) { final AppendingStringBuffer script = new AppendingStringBuffer(75); script.append("\n").append(SCRIPT_OPEN_TAG); addJavaScript(script); script.append(";").append(SCRIPT_CLOSE_TAG); responseBuffer.insert(index, script); } return responseBuffer; } }
@Override protected CharSequence getEventHandler() { return new AppendingStringBuffer(super.getEventHandler()).append("; return false;"); }
/** * Constructor */ public StringResponse() { out = new AppendingStringBuffer(128); }
/** * @see java.lang.Object#toString() */ @Override public String toString() { return out.toString(); }
/** * Resets the response to a clean state so it can be reused to save on garbage. */ @Override public void reset() { buffer.clear(); }