Example usage for org.apache.commons.lang3 StringUtils abbreviate

List of usage examples for org.apache.commons.lang3 StringUtils abbreviate

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils abbreviate.

Prototype

public static String abbreviate(final String str, final int maxWidth) 

Source Link

Document

Abbreviates a String using ellipses.

Usage

From source file:com.sonicle.webtop.calendar.TplHelper.java

public static String buildEventModificationTitle(Locale locale, EventFootprint event, String crud) {
    DateTimeZone etz = DateTimeZone.forID(event.getTimezone());
    StringBuilder sb = new StringBuilder();

    sb.append(StringUtils.abbreviate(event.getTitle(), 30));
    sb.append(" @");

    if (!StringUtils.isEmpty(event.getRecurrenceRule())) {
        RRuleStringify.Strings strings = WT.getRRuleStringifyStrings(locale);
        RRuleStringify rrs = new RRuleStringify(strings, etz);
        sb.append(" (");
        sb.append(rrs.toHumanReadableFrequencyQuietly(event.getRecurrenceRule()));
        sb.append(")");
    }/*from  w w  w  .  j  a  v a 2s . c  om*/

    String SUJECT_KEY = MessageFormatter.format(CalendarLocale.EMAIL_EVENTMODIFICATION_SUBJECT_X, crud)
            .getMessage();
    return MessageFormat.format(WT.lookupResource(SERVICE_ID, locale, SUJECT_KEY), sb.toString());
}

From source file:com.twinsoft.convertigo.beans.statements.CookiesAddStatement.java

@Override
public String toString() {
    return "cookies.add(eval('" + StringUtils.abbreviate(expression, 25) + "'))";
}

From source file:io.bitsquare.gui.components.paymentmethods.AliPayForm.java

@Override
protected void autoFillNameTextField() {
    if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
        String accountNr = accountNrInputTextField.getText();
        accountNr = StringUtils.abbreviate(accountNr, 9);
        String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
        accountNameTextField.setText(method.concat(": ").concat(accountNr));
    }/*from www  .  ja  v a2  s.  c  om*/
}

From source file:com.neatresults.mgnltweaks.ui.contentapp.browser.DetailBrowserSubApp.java

@Override
protected void restoreBrowser(BrowserLocation location) {
    super.restoreBrowser(location);
    caption = StringUtils.reverse(StringUtils.abbreviate(StringUtils.reverse(location.getNodePath()), 20));

    final Object item = contentConnector.getItemIdByUrlFragment(location.getNodePath());
    // expand our item
    workbenchPresenter.expand(item);/*w ww  .j av  a2  s  .  c om*/
}

From source file:io.bitsquare.gui.components.paymentmethods.ChaseQuickPayForm.java

@Override
protected void autoFillNameTextField() {
    if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
        String mobileNr = mobileNrInputTextField.getText();
        mobileNr = StringUtils.abbreviate(mobileNr, 9);
        String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
        accountNameTextField.setText(method.concat(": ").concat(mobileNr));
    }// w  ww.  ja  v  a2 s. c o  m
}

From source file:net.mindengine.blogix.db.readers.ObjectReader.java

private Object convertFieldValue(String fieldValue, Field field) {
    if (fieldValue == null) {
        return null;
    }/*from w  w  w. j a v a2  s.c om*/
    Class<?> type = field.getType();
    try {
        return convertStringValueToType(fieldValue, type);
    } catch (Exception e) {
        throw new IllegalArgumentException("Cannot convert value '" + StringUtils.abbreviate(fieldValue, 20)
                + "' to field " + field.toString(), e);
    }
}

From source file:com.mirth.connect.client.ui.components.rsta.FindReplaceProperties.java

JsonNode toJsonNode() {
    ObjectNode rootNode = JsonNodeFactory.instance.objectNode();

    ArrayNode findHistoryNode = rootNode.putArray("findHistory");
    for (String element : findHistory) {
        findHistoryNode.add(StringUtils.abbreviate(element, 40));
    }/*w w  w  .ja v  a 2 s  .c  om*/

    ArrayNode replaceHistoryNode = rootNode.putArray("replaceHistory");
    for (String element : replaceHistory) {
        replaceHistoryNode.add(StringUtils.abbreviate(element, 40));
    }

    ObjectNode optionsNode = rootNode.putObject("options");
    for (Entry<String, Boolean> entry : optionsMap.entrySet()) {
        optionsNode.put(entry.getKey(), entry.getValue());
    }

    return rootNode;
}

From source file:io.bitsquare.gui.components.paymentmethods.CryptoCurrencyForm.java

@Override
protected void autoFillNameTextField() {
    if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
        String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
        String address = addressInputTextField.getText();
        address = StringUtils.abbreviate(address, 9);
        String currency = paymentAccount.getSingleTradeCurrency() != null
                ? paymentAccount.getSingleTradeCurrency().getCode()
                : "?";
        accountNameTextField.setText(currency.concat(": ").concat(address));
    }//from w w w . j a v a  2 s .c o m
}

From source file:io.bitsquare.gui.components.paymentmethods.USPostalMoneyOrderForm.java

@Override
protected void autoFillNameTextField() {
    if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
        String postalAddress = postalAddressTextArea.getText();
        postalAddress = StringUtils.abbreviate(postalAddress, 9);
        String method = BSResources.get(paymentAccount.getPaymentMethod().getId());
        accountNameTextField.setText(method.concat(": ").concat(postalAddress));
    }// w ww  .  jav  a 2  s.co  m
}

From source file:info.magnolia.ui.admincentral.shellapp.pulse.item.detail.PulseItemCategoryNavigator.java

private void initCheckbox(PulseItemCategory... categories) {
    final String caption = i18n.translate("pulse.items.groupby");
    groupByCheckBox = new CheckBox(StringUtils.abbreviate(caption, 15));
    groupByCheckBox.addStyleName("navigator-grouping");
    groupByCheckBox.setImmediate(true);//  w  ww .ja  v  a 2  s .  com
    groupByCheckBox.setVisible(false);
    // tooltip
    groupByCheckBox.setDescription(caption);

    if (showGroupBy) {
        addComponent(groupByCheckBox);
        for (final PulseItemCategory category : categories) {
            if (category == PulseItemCategory.ALL_MESSAGES) {
                enableGroupBy(true);
            }
        }
    }
}