本文整理汇总了Java中org.apache.commons.lang.WordUtils.wrap方法的典型用法代码示例。如果您正苦于以下问题:Java WordUtils.wrap方法的具体用法?Java WordUtils.wrap怎么用?Java WordUtils.wrap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang.WordUtils
的用法示例。
在下文中一共展示了WordUtils.wrap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLongUsage
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
@Override
public String getLongUsage() {
TableListing listing = AdminHelper.getOptionDescriptionListing();
listing.addRow("<name>", "Name of the pool to modify.");
listing.addRow("<owner>", "Username of the owner of the pool");
listing.addRow("<group>", "Groupname of the group of the pool.");
listing.addRow("<mode>", "Unix-style permissions of the pool in octal.");
listing.addRow("<limit>", "Maximum number of bytes that can be cached " +
"by this pool.");
listing.addRow("<maxTtl>", "The maximum allowed time-to-live for " +
"directives being added to the pool.");
return getShortUsage() + "\n" +
WordUtils.wrap("Modifies the metadata of an existing cache pool. " +
"See usage of " + AddCachePoolCommand.NAME + " for more details.",
AdminHelper.MAX_LINE_WIDTH) + "\n\n" +
listing.toString();
}
示例2: getLongUsage
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
@Override
public String getLongUsage() {
TableListing listing = getOptionDescriptionListing();
listing.addRow("<name>", "Name of the pool to modify.");
listing.addRow("<owner>", "Username of the owner of the pool");
listing.addRow("<group>", "Groupname of the group of the pool.");
listing.addRow("<mode>", "Unix-style permissions of the pool in octal.");
listing.addRow("<limit>", "Maximum number of bytes that can be cached " +
"by this pool.");
listing.addRow("<maxTtl>", "The maximum allowed time-to-live for " +
"directives being added to the pool.");
return getShortUsage() + "\n" +
WordUtils.wrap("Modifies the metadata of an existing cache pool. " +
"See usage of " + AddCachePoolCommand.NAME + " for more details.",
MAX_LINE_WIDTH) + "\n\n" +
listing.toString();
}
示例3: getText
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
@Override
public String getText() {
if (comment != null)
{
String text = "";
if (comment.getName() != null)
{
text= comment.getName() + "\n";
}
if (comment.getComment() != null && !"".equals(comment.getComment()))
{
text += WordUtils.wrap(comment.getComment(), 60);
}
return text;
}
return super.getText();
}
示例4: createFieldEditors
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
@Override
protected void createFieldEditors() {
LabelFieldEditor userHomeDir = new LabelFieldEditor(
"NONE",
WordUtils
.wrap(local.getString("speechAns"), 70),
getFieldEditorParent());
addField(userHomeDir);
final StringFieldEditor speechProcessName = new StringFieldEditor(
PreferenceKeys.SPEECH_PROCESS_NAME, local.getString("speechPrcN"),
getFieldEditorParent());
addField(speechProcessName);
labelButtonFieldEditor = new LabelButtonFieldEditor(
"NONE",
local.getString("testSet"),
getFieldEditorParent(), local.getString("test"), new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
SoundService.getInstance().textToSpeech(
local.getString("speechStpCrct"));
}
});
addField(labelButtonFieldEditor);
}
示例5: createFieldEditors
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
@Override
protected void createFieldEditors() {
LabelFieldEditor userHomeDir = new LabelFieldEditor(
"NONE",
WordUtils
.wrap(local.getString("soundP1"),
70), getFieldEditorParent());
addField(userHomeDir);
final StringFieldEditor soundProcessName = new StringFieldEditor(
PreferenceKeys.SOUND_PROCESS_NAME, local.getString("soundP2"),
getFieldEditorParent());
addField(soundProcessName);
labelButtonFieldEditor = new LabelButtonFieldEditor(
"NONE",
local.getString("soundP3"),
getFieldEditorParent(), local.getString("test"), new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
SoundService.getInstance().initSoundPlayer();
SoundService.getInstance().playSound("win");
}
});
addField(labelButtonFieldEditor);
}
示例6: askYesOrNo
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
@Override
public boolean askYesOrNo(String title, String message) {
StringBuilder updatedMessageBuilder = new StringBuilder(message);
if (message.equals(AccountMessageBundle.message("login.service.are.you.sure.key.text"))) {
updatedMessageBuilder.append(
AccountMessageBundle.message("login.service.are.you.sure.append.text"));
for (GoogleLoginMessageExtender messageExtender : messageExtenders) {
String additionalLogoutMessage = messageExtender.additionalLogoutMessage();
if (!Strings.isNullOrEmpty(additionalLogoutMessage)) {
updatedMessageBuilder.append(" ").append(additionalLogoutMessage);
}
}
}
String updatedMessage =
WordUtils.wrap(
updatedMessageBuilder.toString(),
WRAP_LENGTH,
/* newLinestr */ null,
/* wrapLongWords */ false);
return (Messages.showYesNoDialog(updatedMessage, title, GoogleLoginIcons.GOOGLE_FAVICON)
== Messages.YES);
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:23,代码来源:IntegratedIntellijGoogleLoginService.java
示例7: printClassComment
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
/**
* Prints the comment at the top of the file for this class.
*
* @param ps
* The stream to print the comment to.
*/
private void printClassComment(final PrintStream ps)
{
ps.println("/**");
if (this.comment == null) {
ps.println(" * " + this.uri);
} else {
final String cmt = WordUtils.wrap(" * " +
this.comment.replaceAll("\\r?\\n", " "), 80, "\n * ", false);
ps.println(" " + cmt);
}
ps.println(" *");
ps.println(" *\[email protected] " + new DateTime());
ps.println(" *\[email protected] by owl2java from OpenIMAJ");
ps.println(" */");
}
示例8: wrapText
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
public static String wrapText(String text, int maxLineLength) {
if (StringUtil.isEmpty(text))
return "";
StringBuilder sb = new StringBuilder(text.length());
Scanner scanner = new Scanner(text);
String line;
while (scanner.hasNextLine()){
line = scanner.nextLine();
if (line.length() > maxLineLength)
line = WordUtils.wrap(line, maxLineLength);
sb.append(line)
.append(CR)
.append(LF);
}
return sb.toString();
}
示例9: formatCheckNoteLines
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
/**
* @see org.kuali.kfs.pdp.batch.service.ExtractPaymentService#formatCheckNoteLines(java.lang.String)
*
* Long check stub note
*/
@Override
public List<String> formatCheckNoteLines(String checkNote) {
List<String> formattedCheckNoteLines = new ArrayList<String>();
if (StringUtils.isBlank(checkNote)) {
return formattedCheckNoteLines;
}
String[] textLines = StringUtils.split(checkNote, BusinessObjectReportHelper.LINE_BREAK);
int maxLengthOfNoteLine = dataDictionaryService.getAttributeMaxLength(PaymentNoteText.class, "customerNoteText");
for (String textLine : textLines) {
String text = WordUtils.wrap(textLine, maxLengthOfNoteLine, BusinessObjectReportHelper.LINE_BREAK, true);
String[] wrappedTextLines = StringUtils.split(text, BusinessObjectReportHelper.LINE_BREAK);
for (String wrappedText : wrappedTextLines) {
formattedCheckNoteLines.add(wrappedText);
}
}
return formattedCheckNoteLines;
}
示例10: indentFormat
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
/**
* Format strings for command line output
*
* @param unformattedText
* @param indentFirstLine
* @param indentBalance
* @return
*/
private String indentFormat( String unformattedText, int indentFirstLine, int indentBalance ) {
final int maxWidth = 79;
String leadLine = WordUtils.wrap( unformattedText, maxWidth - indentFirstLine );
StringBuilder result = new StringBuilder();
result.append( "\n" );
if ( leadLine.indexOf( NEW_LINE ) == -1 ) {
result.append( NEW_LINE ).append( StringUtils.repeat( " ", indentFirstLine ) ).append( unformattedText );
} else {
int lineBreakPoint = leadLine.indexOf( NEW_LINE );
String indentString = StringUtils.repeat( " ", indentBalance );
result.append( NEW_LINE ).append( StringUtils.repeat( " ", indentFirstLine ) ).append(
leadLine.substring( 0, lineBreakPoint ) );
String formattedText = WordUtils.wrap( unformattedText.substring( lineBreakPoint ), maxWidth - indentBalance );
for ( String line : formattedText.split( NEW_LINE ) ) {
result.append( NEW_LINE ).append( indentString ).append( line );
}
}
return result.toString();
}
示例11: toString
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
@Override
public String toString() {
StringBuilder bodyBuilder = new StringBuilder();
for (AnsiSnippet snippet : snippets) {
bodyBuilder.append(snippet.toString());
}
String body = bodyBuilder.toString();
if (maxLineWidth < 0) {
return body;
}
String[] lines = body.split("\n");
StringBuilder lineBuilder = new StringBuilder();
for (int i = 0; i < lines.length; i++) {
String line = lines[i];
line = WordUtils.wrap(line, maxLineWidth, "\n" + getIndent(), false);
if (indentFirstLine) {
line = getIndent() + line;
}
lineBuilder.append(line);
if (i != lines.length - 1) {
lineBuilder.append("\n");
}
}
return lineBuilder.toString();
}
示例12: OpenBoardAlias
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
public OpenBoardAlias() {
super(
"openboard",
"Brings up an a classic chess inactive board from the starting position. Optionally you can add a variant.",
"openboard [variant] [FEN].\nVariants supported: "
+ WordUtils.wrap(RaptorStringUtils.toDelimitedString(
Variant.values(), ", "), 70)
+ ".\n Examples: \"openboard\"\n \"openboard suicide\"\n "
+ "\"openboard rnbbkrqn/pppppppp/8/8/8/8/PPPPPPPP/RNBBKRQN w KQkq - 0 1\"\n "
+ "\"openboard suicide rnbbkrqn/pppppppp/8/8/8/8/PPPPPPPP/RNBBKRQN w KQkq - 0 1\"\b");
}
示例13: toVerboseString
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
public String toVerboseString() {
final StringBuilder result = new StringBuilder();
result.append("The ")
.append(objectType.getName())
.append(" class:\n\n")
.append(ObjectDocumentation.getDocumentation(objectType))
.append('\n')
.append(toString())
.append("\nThe content of the attributes of the ")
.append(objectType.getName())
.append(" class are defined below:\n\n");
for (final AttributeTemplate attributeTemplate : attributeTemplates) {
final AttributeType attributeType = attributeTemplate.getAttributeType();
String attributeDescription = attributeType.getDescription(objectType);
if (attributeDescription.indexOf('\n') == -1) {
attributeDescription = WordUtils.wrap(attributeDescription, 70);
}
if (attributeDescription.endsWith("\n")) {
attributeDescription = attributeDescription.substring(0, attributeDescription.length() - 1);
}
String syntaxDescription = attributeType.getSyntax().getDescription(objectType);
if (syntaxDescription.endsWith("\n")) {
syntaxDescription = syntaxDescription.substring(0, syntaxDescription.length() - 1);
}
result.append(attributeType.getName())
.append("\n\n ")
.append(attributeDescription.replaceAll("\n", "\n "))
.append("\n\n ")
.append(syntaxDescription.replaceAll("\n", "\n "))
.append("\n\n");
}
return result.toString();
}
示例14: getBibliographyTable
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
private String getBibliographyTable() {
final ASCIITableHeader[] header = { new ASCIITableHeader("Bibliography", ASCIITable.ALIGN_LEFT) };
String refs = StandardFormatters.STRING.format(bibliography);
refs = WordUtils.wrap(refs, Math.max(exptClass.getName().length() + 10, 72), SystemUtils.LINE_SEPARATOR + " ",
true);
final String[][] data = formatAsTable(refs);
return ASCIITable.getInstance().getTable(header, data);
}
示例15: makeRegistration
import org.apache.commons.lang.WordUtils; //导入方法依赖的package包/类
protected void makeRegistration() {
User user = new User();
user.email = getEmailInput().getText();
user.organization = getOrganizationInput().getText();
user.mayContactUser = getMayContactUser();
user.programmingExperience = getProgrammingExperience();
user.operatingSystem = System.getProperty("os.name");
try {
id = new JsonTransferer().registerNewUser(user);
} catch (ServerCommunicationException exception) {
successfulRegistration = false;
messageTitle = "Problem creating new user!";
messageBody = "<html>" + WordUtils.wrap(exception.getMessage(), 100, "<br>", true);
messageBody += "<br>Are you connected to the internet, and is port 80 open?";
messageBody += "<br>Please contact us via www.testroots.org. <br>We'll troubleshoot the issue!</html>";
return;
}
successfulRegistration = true;
((UserProjectRegistrationWizard) getWizard()).userid = id;
messageTitle = "New user registered!";
messageBody = "Your new user id is registered: ";
Preferences preferences = Preferences.getInstance();
preferences.setUserId(id);
preferences.registerProjectId(WatchDogUtils.getProjectName(), "");
preferences.setProgrammingExperience(user.programmingExperience);
}