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:net.sf.dynamicreports.test.jasper.chart.DifferenceChartTest.java

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

    Locale.setDefault(Locale.ENGLISH);

    rb.columns(column1 = col.column("Column1", "field1", Date.class),
            column2 = col.column("Column2", "field2", Timestamp.class),
            column3 = col.column("Column3", "field3", Integer.class),
            column4 = col.column("Column4", "field4", Integer.class))
            .summary(/* w w  w.ja va  2  s .  c  o  m*/
                    cht.differenceChart().customizers(new ChartCustomizer()).setTimePeriod(column1)
                            .series(cht.serie(column3), cht.serie(column4)).setTimePeriodType(TimePeriod.DAY)
                            .setShowShapes(false).setPositiveColor(Color.BLUE).setNegativeColor(Color.MAGENTA),
                    cht.differenceChart().setTimePeriod(column1).series(cht.serie(column3))
                            .setTimeAxisFormat(cht.axisFormat().setLabel("time").setLabelColor(Color.BLUE)
                                    .setLabelFont(stl.fontArialBold())
                                    .setTickLabelFont(stl.fontArial().setItalic(true))
                                    .setTickLabelColor(Color.CYAN).setLineColor(Color.LIGHT_GRAY)
                                    .setVerticalTickLabels(true)),
                    cht.differenceChart().setTimePeriod(column2).series(cht.serie(column3))
                            .setValueAxisFormat(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).setVerticalTickLabels(true)));
}

From source file:com.p5solutions.core.utils.Comparison.java

/**
 * Checks if is english./*from ww w .  ja  v a  2 s .  co m*/
 * 
 * @param locale
 *          the locale
 * @return true, if is english
 */
public static boolean isEnglish(Locale locale) {
    String lang = Locale.ENGLISH.getLanguage();
    if (lang.equals(locale.getLanguage())) {
        return true;
    }
    return false;
}

From source file:com.backelite.sonarqube.swift.coverage.CoberturaReportParser.java

private static void collectFileData(SMInputCursor clazz, CoverageMeasuresBuilder builder)
        throws XMLStreamException {
    SMInputCursor line = clazz.childElementCursor("lines").advance().childElementCursor("line");
    while (line.getNext() != null) {
        int lineId = Integer.parseInt(line.getAttrValue("number"));
        try {/*w  w  w . ja va 2 s.c o m*/
            builder.setHits(lineId, (int) ParsingUtils.parseNumber(line.getAttrValue("hits"), Locale.ENGLISH));
        } catch (ParseException e) {
            throw new XmlParserException(e);
        }

        String isBranch = line.getAttrValue("branch");
        String text = line.getAttrValue("condition-coverage");
        if (StringUtils.equals(isBranch, "true") && StringUtils.isNotBlank(text)) {
            String[] conditions = StringUtils.split(StringUtils.substringBetween(text, "(", ")"), "/");
            builder.setConditions(lineId, Integer.parseInt(conditions[1]), Integer.parseInt(conditions[0]));
        }
    }
}

From source file:be.fedict.eid.pkira.blm.model.mail.MailTemplateBean.java

/**
 * {@inheritDoc}// w  w  w.j a  v a2  s .com
 */
@Override
public String createMailMessage(String templateName, Map<String, Object> parameters, String localeStr) {
    parameters.put("configuration", configurationEntryQuery.getAsMap());

    Locale locale = Locale.ENGLISH;
    try {
        locale = LocaleUtils.toLocale(localeStr);
    } catch (Exception e) {
        log.error("Invalid locale string: " + localeStr, e);
    }

    try {
        Writer out = new StringWriter();
        Template temp = configuration.getTemplate(templateName, locale);
        temp.process(parameters, out);
        out.flush();

        return out.toString();
    } catch (IOException e) {
        errorLogger.logError(ApplicationComponent.MAIL, "Error creating mail message", e);
        return null;
    } catch (TemplateException e) {
        errorLogger.logError(ApplicationComponent.MAIL, "Error creating mail message", e);
        return null;
    }
}

From source file:com.puppycrawl.tools.checkstyle.checks.AbstractOptionCheck.java

/**
 * Set the option to enforce./*from w w  w . j ava 2s  . co m*/
 * @param optionStr string to decode option from
 * @throws ConversionException if unable to decode
 */
public void setOption(String optionStr) {
    try {
        abstractOption = Enum.valueOf(optionClass, optionStr.trim().toUpperCase(Locale.ENGLISH));
    } catch (IllegalArgumentException iae) {
        throw new ConversionException("unable to parse " + abstractOption, iae);
    }
}

From source file:org.smigo.species.SpeciesHandler.java

public List<Species> searchSpecies(String query, Locale locale) {
    //todo add search on translated family
    List<Species> species = speciesDao.searchSpecies(query, locale);
    if (species.isEmpty()) {
        return speciesDao.searchSpecies(query, Locale.ENGLISH);
    }// w  w w .  j  a  v a2 s.  com
    return species;
}

From source file:com.ibm.watson.app.common.util.rest.HttpStatusAwareResponseHandler.java

@Override
public T handleResponse(HttpResponse response) throws ClientProtocolException, IOException {
    int status = response.getStatusLine().getStatusCode();
    if (logger.isDebugEnabled()) {
        logger.debug("Endpoint response status code " + status);
    }//  w  w  w  .  jav a2  s  .c om

    if (!acceptStatusCode(status)) {
        logger.warn(MessageKey.AQWEGA02001W_received_invalid_http_status_2.getMessage(status,
                EnglishReasonPhraseCatalog.INSTANCE.getReason(status, Locale.ENGLISH)));
        return getDefaultReturnValue();
    }

    return doHandleResponse(response);
}

From source file:de.mg.stock.server.update.StockUpdateFromGoogleHistorical.java

@Override
public List<DayPrice> get(String symbol) {

    String shortSymbol = symbol.substring(0, symbol.lastIndexOf('.'));

    LocalDateTime fetchTime = dateTimeProvider.now();

    String response = httpUtil.get(
            "http://www.google.com/finance/historical?output=csv&startdate=Jan+1%2C+2000&q=" + shortSymbol);
    if (isEmpty(response)) {
        logger.warning("nothing received for " + shortSymbol);
        return Collections.emptyList();
    }/*w  ww .j  av a2  s  . c o  m*/

    String[] lines = response.split(System.getProperty("line.separator"));
    if (lines.length < 2) {
        logger.warning("no lines received for " + shortSymbol);
        return Collections.emptyList();
    }
    if (!lines[0].contains("Date,Open,High,Low,Close,Volume")) {
        logger.warning("wrong header for " + shortSymbol + ": " + lines[0]);
        return Collections.emptyList();
    }

    List<DayPrice> result = new ArrayList<>();

    for (int i = 1; i < lines.length; i++) {
        StringTokenizer tok = new StringTokenizer(lines[i], ",");
        LocalDate date = toLocalDate(tok.nextToken(), "dd-MMMM-yy", Locale.ENGLISH);
        DayPrice dayPrice = new DayPrice(date);
        dayPrice.setFetchedAt(fetchTime);

        // skip
        tok.nextToken();

        dayPrice.setMax(toLong(tok.nextToken()));
        dayPrice.setMin(toLong(tok.nextToken()));

        Long close = toLong(tok.nextToken());
        if (dayPrice.getMax() == null)
            dayPrice.setMax(close);
        if (dayPrice.getMin() == null)
            dayPrice.setMin(close);

        if (dayPrice.getMax() != null && dayPrice.getMin() != null && dayPrice.getMax() != 0
                && dayPrice.getMin() != 0)
            result.add(dayPrice);
    }

    return result;
}

From source file:com.puppycrawl.tools.checkstyle.api.LocalizedMessageTest.java

@Test
public void testBundleReloadUrlNull() throws IOException {
    LocalizedMessage.UTF8Control control = new LocalizedMessage.UTF8Control();
    control.newBundle("com.puppycrawl.tools.checkstyle.checks.coding.messages", Locale.ENGLISH, "java.class",
            Thread.currentThread().getContextClassLoader(), true);
}

From source file:eu.squadd.timesheets.eolas.TimeTemplate.java

public String prepareTimesheet(String[] args) {
    String response = null;/*from   w  w w  . jav a 2s. c o m*/
    try {
        String[] ym = args[0].split("/");
        month = Integer.parseInt(ym[0]);
        year = Integer.parseInt(ym[1]);

        Calendar cal = Calendar.getInstance(TimeZone.getDefault());
        cal.set(Calendar.YEAR, year);
        cal.set(Calendar.MONTH, month - 1);
        int days = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
        monthName = cal.getDisplayName(Calendar.MONTH, Calendar.SHORT_FORMAT, Locale.ENGLISH);
        String periodName = monthName + "-" + year;
        cal.set(Calendar.DATE, 1);
        String dayOfWeek = new SimpleDateFormat("EE").format(cal.getTime());

        System.out.println("Month: " + periodName);
        System.out.println("Days in month: " + days);
        System.out.println("Month starts in: " + dayOfWeek);

        Map<String, String> bankHolidays = year == 2016 ? publicHolidays2016 : publicHolidays2017;
        Map<String, String> holidays = this.extractHolidays(args);

        HSSFWorkbook wb = new HSSFWorkbook(new FileInputStream(template));
        HSSFSheet sheet = wb.getSheet("timesheet"); //getSheetAt(0);
        HSSFRow currentRow;
        SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
        FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
        sheet.getRow(4).getCell(1).setCellValue(periodName);
        int row = 7;
        int startRow = 0;
        int i = 1;
        while (i <= days) {
            currentRow = sheet.getRow(row);
            if (currentRow.getRowNum() > 47)
                break;
            String day = currentRow.getCell(0).getStringCellValue();

            if (day.startsWith("Total")) {
                evaluator.evaluateFormulaCell(currentRow.getCell(2));
                evaluator.evaluateFormulaCell(currentRow.getCell(4));
                row++;
                continue;
            }

            if (startRow == 0) {
                if (dayOfWeek.equals(day.substring(0, 3))) {
                    startRow = currentRow.getRowNum();
                    System.out.println("Starting row found: " + startRow + 1);
                } else {
                    row++;
                    continue;
                }
            }
            cal.set(Calendar.DATE, i);
            String date = sdf.format(cal.getTime());
            if (!day.equals("Saturday") && !day.equals("Sunday") && bankHolidays.get(date) == null
                    && holidays.get(date) == null) {
                currentRow.getCell(1).setCellValue(date);
                currentRow.getCell(2).setCellValue(defaultHours); // regular hours
                //currentRow.getCell(3).setCellValue(defaultHours);   // overtime hours
                currentRow.getCell(4).setCellValue(defaultHours); // total hours                    
            }
            i++;
            row++;
        }
        currentRow = sheet.getRow(46);
        evaluator.evaluateFormulaCell(currentRow.getCell(2));
        evaluator.evaluateFormulaCell(currentRow.getCell(4));
        currentRow = sheet.getRow(47);
        evaluator.evaluateFormulaCell(currentRow.getCell(2));
        evaluator.evaluateFormulaCell(currentRow.getCell(4));
        response = outFilePath.replace("#MONTH#", periodName);
        wb.write(new FileOutputStream(response));

    } catch (IOException ex) {
        Logger.getLogger(Timesheets.class.getName()).log(Level.SEVERE, null, ex);
    }
    System.out.println("Timesheet created.");
    return response;
}