当前位置: 首页>>代码示例>>Java>>正文


Java AppendingStringBuffer.append方法代码示例

本文整理汇总了Java中org.apache.wicket.util.string.AppendingStringBuffer.append方法的典型用法代码示例。如果您正苦于以下问题:Java AppendingStringBuffer.append方法的具体用法?Java AppendingStringBuffer.append怎么用?Java AppendingStringBuffer.append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.wicket.util.string.AppendingStringBuffer的用法示例。


在下文中一共展示了AppendingStringBuffer.append方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toMultilineMarkup

import org.apache.wicket.util.string.AppendingStringBuffer; //导入方法依赖的package包/类
private CharSequence toMultilineMarkup(final CharSequence s) {
	if (s == null) {
		return null;
	}

	final AppendingStringBuffer buffer = new AppendingStringBuffer();

	for (int i = 0; i < s.length(); i++) {
		final char c = s.charAt(i);

		switch (c) {
		case '\n':
			buffer.append("<br/>");
			break;

		case '\r':
			break;

		default:
			buffer.append(c);
			break;
		}
	}
	return buffer;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:26,代码来源:MultilineLabel.java

示例2: appendOptionHtml

import org.apache.wicket.util.string.AppendingStringBuffer; //导入方法依赖的package包/类
@Override
protected void appendOptionHtml(AppendingStringBuffer buffer, User choice, int index, String selected) {
	if (isNewGroup(choice)) {
		if (!isFirst(index)) {
			buffer.append("</optgroup>");
		}
		buffer.append("<optgroup label='");
		buffer.append(Strings.escapeMarkup(getGroupLabel(choice)));
		buffer.append("'>");
	}
	super.appendOptionHtml(buffer, choice, index, selected);
	if (isLast(index)) {
		buffer.append("</optgroup>");
	}
	last = choice;
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:17,代码来源:UserSelect2DropDownChoice.java

示例3: appendOptionHtml

import org.apache.wicket.util.string.AppendingStringBuffer; //导入方法依赖的package包/类
@Override
protected void appendOptionHtml(AppendingStringBuffer buffer, T choice, int index, String selected) {
	if (grouped) {
		if (last == null || isNewGroup(choice, last)) {
			if (!isFirst(index)) {
				buffer.append("</optgroup>");
			}
			buffer.append("<optgroup label='");
			buffer.append(Strings.escapeMarkup(getGroupLabel(choice)));
			buffer.append("'>");
		}
		super.appendOptionHtml(buffer, choice, index, selected);
		if (isLast(index)) {
			buffer.append("</optgroup>");
		}
		last = choice;
	} else {
		super.appendOptionHtml(buffer, choice, index, selected);
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:21,代码来源:GenericSelect2GroupDropDownSingleChoice.java

示例4: appendOptionHtml

import org.apache.wicket.util.string.AppendingStringBuffer; //导入方法依赖的package包/类
@Override
protected void appendOptionHtml(AppendingStringBuffer buffer, E choice, int index, String selected) {
	if (grouped) {
		if (last == null || isNewGroup(choice, last)) {
			if (!isFirst(index)) {
				buffer.append("</optgroup>");
			}
			buffer.append("<optgroup label='");
			buffer.append(Strings.escapeMarkup(getGroupLabel(choice)));
			buffer.append("'>");
		}
		super.appendOptionHtml(buffer, choice, index, selected);
		if (isLast(index)) {
			buffer.append("</optgroup>");
		}
		last = choice;
	} else {
		super.appendOptionHtml(buffer, choice, index, selected);
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:21,代码来源:AbstractOptGroupDropDownChoice.java

示例5: filter

import org.apache.wicket.util.string.AppendingStringBuffer; //导入方法依赖的package包/类
/**
 * @see org.apache.wicket.IResponseFilter#filter(AppendingStringBuffer)
 */
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;
}
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:36,代码来源:ServerPageMetaFilter.java

示例6: appendOptionHtml

import org.apache.wicket.util.string.AppendingStringBuffer; //导入方法依赖的package包/类
@SuppressWarnings({"RefusedBequest", "unchecked"})
@Override
protected void appendOptionHtml(AppendingStringBuffer buffer, File choice, int index, String selected) {
    IChoiceRenderer<? super File> renderer = getChoiceRenderer();
    Object objectValue = renderer.getDisplayValue(choice);
    String displayValue = "";
    if (objectValue != null) {
        IConverter converter = getConverter(objectValue.getClass());
        displayValue = converter
                .convertToString(objectValue, getLocale());
    }

    if ("".equals(displayValue)) {
        displayValue = getString("file.browser.breadCrumbs.root", null);
    }
    buffer.append("\n<option ");
    if (isSelected(choice, index, selected)) {
        buffer.append("selected=\"selected\" ");
    }

    buffer.append("style=\"padding-left: " + (index * 10 + 18) + "px; " +
            "background-position: " + index * 10 + "px\" ");
    index++;

    buffer.append("value=\"");
    buffer.append(Strings.escapeMarkup(renderer.getIdValue(choice, index)));
    buffer.append("\">");

    CharSequence escaped = escapeOptionHtml(displayValue);
    buffer.append(escaped);
    buffer.append("</option>");
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:33,代码来源:FileBrowserPanel.java

示例7: renderHead

import org.apache.wicket.util.string.AppendingStringBuffer; //导入方法依赖的package包/类
@Override
public void renderHead(IHeaderResponse response) {
  super.renderHead(response);

  AppendingStringBuffer asb = new AppendingStringBuffer();
  asb.append("function attachChoiceHandler(markupId, callbackScript) {\n");
  asb.append(" var inputNode = wicketGet(markupId);\n");
  asb.append(" var inputType = inputNode.type.toLowerCase();\n");
  asb.append(" if (inputType == 'checkbox' || inputType == 'radio') {\n");
  asb.append(" Wicket.Event.add(inputNode, 'click', callbackScript);\n");
  asb.append(" }\n");
  asb.append("}\n");

  response.renderJavascript(asb, "attachChoiceParent");
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:16,代码来源:AjaxParentFormChoiceComponentUpdatingBehavior.java

示例8: setOptionAttributes

import org.apache.wicket.util.string.AppendingStringBuffer; //导入方法依赖的package包/类
@Override
protected void setOptionAttributes(AppendingStringBuffer buffer, T choice,
		int index, String selected) {
	super.setOptionAttributes(buffer, choice, index, selected);
	int depth = calculateDepth(choice);
	buffer.append(" class=\"treedepth").append(depth).append("\"");
	if(disableParents && choice.getChildren()!=null && !choice.getChildren().isEmpty())
		buffer.append(" disabled=\"disabled\"");
}
 
开发者ID:premium-minds,项目名称:pm-wicket-utils,代码行数:10,代码来源:BootstrapHierarchizedDropDownChoice.java

示例9: onComponentTagBody

import org.apache.wicket.util.string.AppendingStringBuffer; //导入方法依赖的package包/类
/**
 * Append an additional hidden input tag that forces Wicket to correctly
 * determine the destination page class even after a session expiration or
 * a server restart.
 *
 * @param markupStream
 *            The markup stream
 * @param openTag
 *            The open tag for the body
 */
@Override
protected void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag)
{
	// render the hidden bookmarkable page field
	AppendingStringBuffer buffer = new AppendingStringBuffer(HIDDEN_DIV_START);
	buffer.append("<input type=\"hidden\" name=\"")
		.append(WebRequestCodingStrategy.BOOKMARKABLE_PAGE_PARAMETER_NAME)
		.append("\" value=\":")
		.append(pageClass.getName())
		.append("\" />");

	// insert the page parameters, if any, as hidden fields as long as they
	// do not collide with any child wicket:id of the form.
	if (pageParameters != null) {
		for (String key : pageParameters.keySet()) {
			Component c = get(key);
			if (c != null) {
				// this form has a field id which matches the
				// parameter name, skip embedding a hidden value
				logger().warn(
						MessageFormat
								.format("Skipping page parameter \"{0}\" from sessionless form hidden fields because it collides with a form child wicket:id",
										key));
				continue;
			}
			String value = pageParameters.getString(key);
			buffer.append("<input type=\"hidden\" name=\"")
			.append(recode(key))
			.append("\" value=\"")
			.append(recode(value))
			.append("\" />");
		}
	}

	buffer.append("</div>");
	getResponse().write(buffer);
	super.onComponentTagBody(markupStream, openTag);
}
 
开发者ID:tomaswolf,项目名称:gerrit-gitblit-plugin,代码行数:49,代码来源:SessionlessForm.java

示例10: onComponentTagBody

import org.apache.wicket.util.string.AppendingStringBuffer; //导入方法依赖的package包/类
/**
 * Append an additional hidden input tag that forces Wicket to correctly
 * determine the destination page class even after a session expiration or
 * a server restart.
 * 
 * @param markupStream
 *            The markup stream
 * @param openTag
 *            The open tag for the body
 */
@Override
protected void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag)
{
	// render the hidden bookmarkable page field
	AppendingStringBuffer buffer = new AppendingStringBuffer(HIDDEN_DIV_START);
	buffer.append("<input type=\"hidden\" name=\"")
		.append(WebRequestCodingStrategy.BOOKMARKABLE_PAGE_PARAMETER_NAME)
		.append("\" value=\":")
		.append(pageClass.getName())
		.append("\" />");

	// insert the page parameters, if any, as hidden fields as long as they
	// do not collide with any child wicket:id of the form.
	if (pageParameters != null) {
		for (String key : pageParameters.keySet()) {
			Component c = get(key);
			if (c != null) {
				// this form has a field id which matches the
				// parameter name, skip embedding a hidden value
				log.warn(MessageFormat.format("Skipping page parameter \"{0}\" from sessionless form hidden fields because it collides with a form child wicket:id", key));
				continue;
			}
			String value = pageParameters.getString(key);
			buffer.append("<input type=\"hidden\" name=\"")
			.append(recode(key))
			.append("\" value=\"")
			.append(recode(value))
			.append("\" />");
		}
	}

	buffer.append("</div>");
	getResponse().write(buffer);
	super.onComponentTagBody(markupStream, openTag);
}
 
开发者ID:warpfork,项目名称:gitblit,代码行数:46,代码来源:SessionlessForm.java

示例11: appendOptionHtml

import org.apache.wicket.util.string.AppendingStringBuffer; //导入方法依赖的package包/类
@Override
protected void appendOptionHtml(AppendingStringBuffer buffer, T choice, int index, String selected) {
    // CHECKSTYLE:ON
    String label = generateLabelForChoice(choice);

    // If there is a display value for the choice, then we know that the choice is automatic in some way. If label
    // is /null/ then we know that the choice is a manually created checkbox tag at some random location in the page
    // markup!
    if (label == null) {
        return;
    }

    String id = getChoiceRenderer().getIdValue(choice, index);
    String idAttr = getMarkupId() + "-" + id;

    boolean isSelected = isSelected(choice, index, selected);
    boolean enabled = isEnabledInHierarchy() && !isDisabled(choice, index, selected);

    Tag inputTag =
        new Tag("input").attr("name", getInputName()).attr("type", "radio")
                .attr("checked", "checked", isSelected).attr("disabled", "disabled", !enabled).attr("value", id)
                .attr("id", idAttr).attr("style", "display:none");

    // Should a roundtrip be made (have onSelectionChanged called) when the option is clicked?
    if (wantOnSelectionChangedNotifications()) {
        inputTag.attr("onclick", buildOnClickUrl(id));
    }

    if (getApplication().getDebugSettings().isOutputComponentPath()) {
        inputTag.attr("wicketpath", buildWicketPath(index));
    }

    // Add label for radio button
    Tag labelTag =
        new Tag("label").attr("for", idAttr).attr("class", generateLabelTagClass(choice, index, isSelected));

    inputTag.attrs(getAdditionalAttributes(index, choice));
    inputTag.attrs(getAdditionalAttributesForLabel(index, choice));

    labelTag.add(inputTag);
    labelTag.add(generateLabelBody(label).toString());

    buffer.append(getPrefix(index, choice));
    buffer.append(labelTag);
    buffer.append(getSuffix(index, choice));
}
 
开发者ID:flex-oss,项目名称:flex-ui,代码行数:47,代码来源:ButtonRadioChoice.java

示例12: appendOptionHtml

import org.apache.wicket.util.string.AppendingStringBuffer; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void appendOptionHtml(final AppendingStringBuffer buffer, final T choice, int index,
    final String selected) {
    Object displayValue = getChoiceRenderer().getDisplayValue(choice);
    Class<?> objectClass = displayValue == null ? null : displayValue.getClass();

    // Get label for choice
    String label = "";
    if (objectClass != null && objectClass != String.class) {
        @SuppressWarnings("rawtypes")
        IConverter converter = getConverter(objectClass);
        label = converter.convertToString(displayValue, getLocale());
    } else if (displayValue != null) {
        label = displayValue.toString();
    }

    // If there is a display value for the choice, then we know that the
    // choice is automatic in some way. If label is /null/ then we know
    // that the choice is a manually created checkbox tag at some random
    // location in the page markup!
    if (label != null) {
        String id = getChoiceRenderer().getIdValue(choice, index);
        final String idAttr = getCheckBoxMarkupId(id);
        boolean isSlected = isSelected(choice, index, selected);

        // Append option suffix
        buffer.append(getPrefix(index, choice));

        Tag tag = new Tag("label").attr("for", idAttr);

        List<String> labelClasses = new ArrayList<>();
        labelClasses.add("btn");
        if (isSlected) {
            labelClasses.add("active");
            labelClasses.add(getActiveLabelClass(choice, index));
        } else {
            labelClasses.add(getLabelClass(choice, index));
        }
        tag.attr("class", labelClasses);

        // Add checkbox element
        Tag input = new Tag("input").attr("name", getInputName()).attr("type", "checkbox");
        input.attr("value", id).attr("id", idAttr);
        input.attr("checked", "checked", isSlected);
        input.attr("disabled", "disabled", isDisabled(choice, index, selected) || !isEnabledInHierarchy());

        // Allows user to add attributes to the <input..> tag
        {
            IValueMap attrs = getAdditionalAttributes(index, choice);
            if (attrs != null) {
                input.getAttributes().putAll(attrs);
            }
        }

        if (getApplication().getDebugSettings().isOutputComponentPath()) {
            CharSequence path = getPageRelativePath();
            path = Strings.replaceAll(path, "_", "__");
            path = Strings.replaceAll(path, ":", "_");
            input.attr("wicketpath", path + "_input_" + index);
        }

        tag.add(input);

        // Add label for checkbox
        tag.add(getLabelText(label));

        buffer.append(tag.toString());
        // Append option suffix
        buffer.append(getSuffix(index, choice));
    }
    // CHECKSTYLE:ON
}
 
开发者ID:flex-oss,项目名称:flex-ui,代码行数:74,代码来源:ButtonMultipleChoice.java


注:本文中的org.apache.wicket.util.string.AppendingStringBuffer.append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。