當前位置: 首頁>>代碼示例>>Java>>正文


Java WordUtils.wrap方法代碼示例

本文整理匯總了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();
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:20,代碼來源:CacheAdmin.java

示例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();
}
 
開發者ID:Nextzero,項目名稱:hadoop-2.6.0-cdh5.4.3,代碼行數:20,代碼來源:CacheAdmin.java

示例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();
}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:18,代碼來源:BTSCommentAnnotation.java

示例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);
}
 
開發者ID:evilwan,項目名稱:raptor-chess-interface,代碼行數:27,代碼來源:SpeechPage.java

示例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);
}
 
開發者ID:evilwan,項目名稱:raptor-chess-interface,代碼行數:27,代碼來源:SoundPage.java

示例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(" */");
}
 
開發者ID:openimaj,項目名稱:openimaj,代碼行數:23,代碼來源:ClassDef.java

示例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();
	}
 
開發者ID:lucee,項目名稱:Lucee,代碼行數:22,代碼來源:StringDataSource.java

示例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;
}
 
開發者ID:kuali,項目名稱:kfs,代碼行數:25,代碼來源:ExtractPaymentServiceImpl.java

示例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();
}
 
開發者ID:pentaho,項目名稱:pentaho-kettle,代碼行數:28,代碼來源:RepositoryCleanupUtil.java

示例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();
}
 
開發者ID:spinnaker,項目名稱:halyard,代碼行數:37,代碼來源:AnsiParagraphBuilder.java

示例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");
}
 
開發者ID:evilwan,項目名稱:raptor-chess-interface,代碼行數:12,代碼來源:OpenBoardAlias.java

示例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();
}
 
開發者ID:rpsl4j,項目名稱:rpsl4j-parser,代碼行數:41,代碼來源:ObjectTemplate.java

示例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);
}
 
開發者ID:openimaj,項目名稱:openimaj,代碼行數:11,代碼來源:ExperimentContext.java

示例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);
}
 
開發者ID:TestRoots,項目名稱:watchdog,代碼行數:30,代碼來源:UserRegistrationStep.java


注:本文中的org.apache.commons.lang.WordUtils.wrap方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。