org.apache.wicket.util.string.AppendingStringBuffer Java Examples

The following examples show how to use org.apache.wicket.util.string.AppendingStringBuffer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultilineLabel.java    From onedev with MIT License 6 votes vote down vote up
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;
}
 
Example #2
Source File: OverviewListChoice.java    From webanno with Apache License 2.0 5 votes vote down vote up
@Override
protected void setOptionAttributes(AppendingStringBuffer aBuffer, T aChoice, int aIndex,
        String aSelected)
{
    super.setOptionAttributes(aBuffer, aChoice, aIndex, aSelected);
    // if the choice was decorated with color, add this option to the html
    if (aChoice instanceof DecoratedObject) {
        DecoratedObject decorated = (DecoratedObject) aChoice;
        String color = defaultIfEmpty(decorated.getColor(), "black");
        aBuffer.append("style=\"color:" + color + ";\"");
    }
}
 
Example #3
Source File: AjaxParentFormChoiceComponentUpdatingBehavior.java    From ontopia with Apache License 2.0 5 votes vote down vote up
@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");
}
 
Example #4
Source File: BootstrapHierarchizedDropDownChoice.java    From pm-wicket-utils with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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\"");
}