List of usage examples for org.apache.wicket.util.string AppendingStringBuffer insert
public AppendingStringBuffer insert(final int offset, final double d)
double argument into this string buffer. From source file:com.francetelecom.clara.cloud.presentation.tools.ServerPageMetaFilter.java
License:Apache License
/** * @see org.apache.wicket.IResponseFilter#filter(AppendingStringBuffer) *///from w w w . j a v a2 s . co m public AppendingStringBuffer filter(AppendingStringBuffer responseBuffer) { String responseHtmlTagUsed = "</html>"; int index = responseBuffer.indexOf(responseHtmlTagUsed); long timeTaken = System.currentTimeMillis() - RequestCycle.get().getStartTime(); if (index != -1) { AppendingStringBuffer script = new AppendingStringBuffer(125); script.append("\n<!--"); // server time used script.append("\n window.pagemeta.serverPageRenderingTime=' "); script.append(((double) timeTaken) / 1000); script.append("s';\n"); // server ip script.append("\n window.pagemeta.serverIP='"); script.append(retrieveServerIP()); script.append("';\n"); // rendering date script.append("\n window.pagemeta.renderingDate='"); script.append(retrieveRenderingDateStr()); script.append("';\n"); script.append(" -->\n"); responseBuffer.insert(index, script); } log.debug(timeTaken + "ms server time taken for request " + RequestCycle.get().getRequest().getUrl() + " response size: " + responseBuffer.length()); return responseBuffer; }
From source file:com.norconex.jefmon.settings.panels.JobLocationsPanel.java
License:Apache License
private ListMultipleChoice<File> buildLocationsSelect(String markupId) { final ListMultipleChoice<File> lc = new ListMultipleChoice<File>(markupId, new ListModel<File>(), locations) {//from w w w . j a v a 2 s . c o m private static final long serialVersionUID = 7754249758151817399L; @Override protected CharSequence getDefaultChoice(String selected) { return ""; } @Override protected void appendOptionHtml(AppendingStringBuffer buffer, File file, int index, String selected) { super.appendOptionHtml(buffer, file, index, selected); if (file == null) { return; } String icon = "nx-file-icon"; if (file.isDirectory()) { icon = "nx-folder-icon"; } buffer.insert(buffer.lastIndexOf("\">") + 1, " class=\"" + icon + "\""); } }; lc.setMaxRows(7); lc.setOutputMarkupId(true); lc.add(new AjaxFormComponentUpdatingBehavior("onchange") { private static final long serialVersionUID = -6508661554028761884L; @Override protected void onUpdate(AjaxRequestTarget target) { adjustButtonVisibility(target); } }); return lc; }
From source file:org.wicketstuff.minis.filter.ServerHostNameAndTimeFilter.java
License:Apache License
/** * {@inheritDoc}/*from w w w . j a v a2 s . c om*/ */ 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; }
From source file:org.wicketstuff.misc.filters.ServerHostNameAndTimeFilter.java
License:Apache License
/** * @see org.apache.wicket.IResponseFilter#filter(AppendingStringBuffer) *//* www. j a v a 2 s . c o m*/ public AppendingStringBuffer filter(AppendingStringBuffer responseBuffer) { int index = responseBuffer.indexOf("<head>"); long timeTaken = System.currentTimeMillis() - RequestCycle.get().getStartTime(); if (index != -1) { AppendingStringBuffer script = new AppendingStringBuffer(75); script.append("\n"); script.append(JavascriptUtils.SCRIPT_OPEN_TAG); script.append("\n\twindow.defaultStatus='"); script.append("Host: "); script.append(host); script.append(", handled in: "); script.append(Duration.milliseconds(timeTaken)); script.append("';\n"); script.append(JavascriptUtils.SCRIPT_CLOSE_TAG); script.append("\n"); responseBuffer.insert(index + 6, script); } return responseBuffer; }