Example usage for java.util Locale ENGLISH

List of usage examples for java.util Locale ENGLISH

Introduction

In this page you can find the example usage for java.util Locale ENGLISH.

Prototype

Locale ENGLISH

To view the source code for java.util Locale ENGLISH.

Click Source Link

Document

Useful constant for language.

Usage

From source file:com.opengamma.web.AbstractWebResource.java

/**
 * Builds the sort order.//from w  ww. j a v  a  2s. c  om
 * <p>
 * This method is lenient, returning the default in case of error.
 * 
 * @param <T>  the sort order type
 * @param order  the sort order, null or empty returns default
 * @param defaultOrder  the default order, not null
 * @return the sort order, not null
 */
protected <T extends Enum<T>> T buildSortOrder(String order, T defaultOrder) {
    if (StringUtils.isEmpty(order)) {
        return defaultOrder;
    }
    order = order.toUpperCase(Locale.ENGLISH);
    if (order.endsWith(" ASC")) {
        order = StringUtils.replace(order, " ASC", "_ASC");
    } else if (order.endsWith(" DESC")) {
        order = StringUtils.replace(order, " DESC", "_DESC");
    } else if (order.endsWith("_ASC") == false && order.endsWith("_DESC") == false) {
        order = order + "_ASC";
    }
    try {
        Class<T> cls = defaultOrder.getDeclaringClass();
        return Enum.valueOf(cls, order);
    } catch (IllegalArgumentException ex) {
        return defaultOrder;
    }
}

From source file:com.stimulus.archiva.presentation.ArchiveRuleBean.java

public String getAction() {
    return filterRule.getAction().toString().toLowerCase(Locale.ENGLISH);
}

From source file:com.juliuskrah.multipart.service.impl.UserDetailsServiceImpl.java

@Override
@Transactional(readOnly = true)//  www . j  a va2 s .  com
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
    log.debug("Starting authentication for {}...", username);
    String lowercaseUsername = username.toLowerCase(Locale.ENGLISH);
    Optional<Account> userFromDb = accountRepository.findByUsername(lowercaseUsername);
    // @formatter:off
    return userFromDb.map(user -> {
        if (!user.isActivated())
            throw new UserNotActivatedException(String.format("User %s is not activated", lowercaseUsername));
        List<GrantedAuthority> grantedAuthorities = user.getAuthorities().stream()
                .map(authority -> new SimpleGrantedAuthority(authority.getName())).collect(Collectors.toList());
        return new User(lowercaseUsername, user.getPassword(), grantedAuthorities);
    }).orElseThrow(() -> new UsernameNotFoundException(
            String.format("User %s was not found in the database", lowercaseUsername)));
    // @formatter:on
}

From source file:net.sf.dynamicreports.test.jasper.chart.BubbleChartTest.java

@Override
protected void configureReport(JasperReportBuilder rb) {
    TextColumnBuilder<Integer> column1;
    TextColumnBuilder<Integer> column2;
    TextColumnBuilder<Double> column3;

    Locale.setDefault(Locale.ENGLISH);

    rb.columns(column1 = col.column("Column1", "field1", Integer.class),
            column2 = col.column("Column2", "field2", Integer.class),
            column3 = col.column("Column3", "field3", Double.class))
            .summary(/*from w  ww  . j  ava2s  . c  o  m*/
                    cht.bubbleChart().setXValue(column1)
                            .series(cht.xyzSerie().setYValue(column2).setZValue(column3)
                                    .setSeries(exp.text("a")),
                                    cht.xyzSerie().setXValue(column2).setYValue(column1).setZValue(column3))
                            .setScaleType(ScaleType.ON_BOTH_AXES),
                    cht.bubbleChart().setXValue(column1)
                            .series(cht.xyzSerie().setYValue(column2).setZValue(column3))
                            .setXAxisFormat(cht.axisFormat().setLabel("category").setLabelColor(Color.BLUE)
                                    .setLabelFont(stl.fontArialBold())
                                    .setTickLabelFont(stl.fontArial().setItalic(true))
                                    .setTickLabelColor(Color.CYAN).setLineColor(Color.LIGHT_GRAY)),
                    cht.bubbleChart().setXValue(column1)
                            .series(cht.xyzSerie().setYValue(column2).setZValue(column3))
                            .setYAxisFormat(cht.axisFormat().setLabel("value").setLabelColor(Color.BLUE)
                                    .setLabelFont(stl.fontArialBold())
                                    .setTickLabelFont(stl.fontArial().setItalic(true))
                                    .setTickLabelColor(Color.CYAN).setTickLabelMask("#,##0.00")
                                    .setLineColor(Color.LIGHT_GRAY)));
}

From source file:net.sf.dynamicreports.test.jasper.chart.ScatterChartTest.java

@Override
protected void configureReport(JasperReportBuilder rb) {
    TextColumnBuilder<Integer> column1;
    TextColumnBuilder<Integer> column2;

    Locale.setDefault(Locale.ENGLISH);

    rb.columns(column1 = col.column("Column1", "field1", Integer.class),
            column2 = col.column("Column2", "field2", Integer.class))
            .summary(/*from   w  w  w . ja  v a2s . co m*/
                    cht.scatterChart().setXValue(column1)
                            .series(cht.xySerie(column2), cht.xySerie(column1).setXValue(column2))
                            .setShowShapes(false).setShowLines(false),
                    cht.scatterChart().setXValue(column1).series(cht.xySerie(column2))
                            .setXAxisFormat(cht.axisFormat().setLabel("category").setLabelColor(Color.BLUE)
                                    .setLabelFont(stl.fontArialBold())
                                    .setTickLabelFont(stl.fontArial().setItalic(true))
                                    .setTickLabelColor(Color.CYAN).setLineColor(Color.LIGHT_GRAY)),
                    cht.scatterChart().setXValue(column1).series(cht.xySerie(column2))
                            .setYAxisFormat(cht.axisFormat().setLabel("value").setLabelColor(Color.BLUE)
                                    .setLabelFont(stl.fontArialBold())
                                    .setTickLabelFont(stl.fontArial().setItalic(true))
                                    .setTickLabelColor(Color.CYAN).setTickLabelMask("#,##0.00")
                                    .setLineColor(Color.LIGHT_GRAY)));
}

From source file:de.hybris.platform.b2b.services.impl.B2BCostCenterServiceTest.java

@Before
public void before() throws Exception {
    B2BIntegrationTest.loadTestData();//w  ww.jav  a2 s.c  om
    importCsv("/b2bapprovalprocess/test/b2borganizations.csv", "UTF-8");
    //importCsv("/b2bapprovalprocess/test/organizationdata.csv", "UTF-8");

    sessionService.getCurrentSession().setAttribute("user",
            this.modelService.<Object>toPersistenceLayer(userService.getAdminUser()));
    i18nService.setCurrentLocale(Locale.ENGLISH);
    commonI18NService.setCurrentLanguage(commonI18NService.getLanguage("en"));
    commonI18NService.setCurrentCurrency(commonI18NService.getCurrency("USD"));
}

From source file:org.web4thejob.util.L10nUtil.java

public static String getMessage(Class<?> clazz, String code, Object[] args, String defaultValue) {
    if (getMessageSource() != null) {
        try {/*from   ww w.j  a  v  a 2s .  c om*/
            return getMessageSource().getMessage(clazz.getName() + "." + code, args, CoreUtil.getUserLocale());
        } catch (NoSuchMessageException e) {
            if (!CoreUtil.getUserLocale().equals(Locale.ENGLISH)) {
                logMissingMessage(clazz.getName() + "." + code, defaultValue);
            }
        }
    }

    if (args != null) {
        return MessageFormat.format(defaultValue, args);
    } else {
        return defaultValue;
    }

}

From source file:net.sf.dynamicreports.test.jasper.chart.XyAreaChartTest.java

@Override
protected void configureReport(JasperReportBuilder rb) {
    TextColumnBuilder<Integer> column1;
    TextColumnBuilder<Integer> column2;

    Locale.setDefault(Locale.ENGLISH);

    rb.columns(column1 = col.column("Column1", "field1", Integer.class),
            column2 = col.column("Column2", "field2", Integer.class))
            .summary(cht.xyAreaChart().setXValue(column1).series(cht.xySerie(column2))
                    .setXAxisFormat(cht.axisFormat().setLabel("category").setLabelColor(Color.BLUE)
                            .setLabelFont(stl.fontArialBold()).setTickLabelFont(stl.fontArial().setItalic(true))
                            .setTickLabelColor(Color.CYAN).setLineColor(Color.LIGHT_GRAY)),
                    cht.xyAreaChart().setXValue(column1).series(cht.xySerie(column2))
                            .setYAxisFormat(cht.axisFormat().setLabel("value").setLabelColor(Color.BLUE)
                                    .setLabelFont(stl.fontArialBold())
                                    .setTickLabelFont(stl.fontArial().setItalic(true))
                                    .setTickLabelColor(Color.CYAN).setTickLabelMask("#,##0.00")
                                    .setLineColor(Color.LIGHT_GRAY).setRangeMinValueExpression(1)
                                    .setRangeMaxValueExpression(15)));
}

From source file:net.sf.dynamicreports.test.jasper.chart.XyBarChartTest.java

@Override
protected void configureReport(JasperReportBuilder rb) {
    TextColumnBuilder<Integer> column1;
    TextColumnBuilder<Integer> column2;

    Locale.setDefault(Locale.ENGLISH);

    rb.columns(column1 = col.column("Column1", "field1", Integer.class),
            column2 = col.column("Column2", "field2", Integer.class))
            .summary(cht.xyBarChart().setXValue(column1).series(cht.xySerie(column2)).setShowLabels(true)
    /*.setShowTickLabels(false)
    .setShowTickMarks(false)*/, cht.xyBarChart().setXValue(column1).series(cht.xySerie(column2))
            .setXAxisFormat(cht.axisFormat().setLabel("category").setLabelColor(Color.BLUE)
                    .setLabelFont(stl.fontArialBold()).setTickLabelFont(stl.fontArial().setItalic(true))
                    .setTickLabelColor(Color.CYAN).setLineColor(Color.LIGHT_GRAY)),
                    cht.xyBarChart().setXValue(column1).series(cht.xySerie(column2))
                            .setYAxisFormat(cht.axisFormat().setLabel("value").setLabelColor(Color.BLUE)
                                    .setLabelFont(stl.fontArialBold())
                                    .setTickLabelFont(stl.fontArial().setItalic(true))
                                    .setTickLabelColor(Color.CYAN).setTickLabelMask("#,##0.00")
                                    .setLineColor(Color.LIGHT_GRAY).setRangeMinValueExpression(1)
                                    .setRangeMaxValueExpression(15)));
}