Example usage for java.util Locale setDefault

List of usage examples for java.util Locale setDefault

Introduction

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

Prototype

public static synchronized void setDefault(Locale newLocale) 

Source Link

Document

Sets the default locale for this instance of the Java Virtual Machine.

Usage

From source file:ca.nines.ise.cmd.Wikify.java

/**
 * {@inheritDoc}//ww w .j a v a2 s  .c  om
 */
@Override
public void execute(CommandLine cmd) throws Exception {
    Locale.setDefault(Locale.ENGLISH);
    PrintStream out = new PrintStream(System.out, true, "UTF-8");

    if (cmd.hasOption("o")) {
        out = new PrintStream(new FileOutputStream(cmd.getOptionValue("l")), true, "UTF-8");
    }

    if (cmd.hasOption("chars")) {
        wikifyCharacters(out);
    }

    if (cmd.hasOption("schema")) {
        wikifySchema(out);
    }

    if (cmd.hasOption("codepoints")) {
        wikifyCodepoints(out);
    }
}

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

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

    Locale.setDefault(Locale.ENGLISH);

    rb.columns(column1 = col.column("Column1", "field1", String.class),
            column2 = col.column("Column2", "field2", Integer.class))
            .summary(/*from ww w .j  a va2s .  c o  m*/
                    cht.stackedBar3DChart().setCategory(column1).series(cht.serie(column2)).setShowLabels(true)
                            .setXOffset(2d).setYOffset(3d),
                    cht.stackedBar3DChart().setCategory(column1).series(cht.serie(column2))
                            .setCategoryAxisFormat(cht.axisFormat().setLabel("category")
                                    .setLabelColor(Color.BLUE).setLabelFont(stl.fontArialBold())
                                    .setTickLabelFont(stl.fontArial().setItalic(true))
                                    .setTickLabelColor(Color.CYAN).setTickLabelRotation(45d)
                                    .setLineColor(Color.LIGHT_GRAY)),
                    cht.stackedBar3DChart().setCategory(column1).series(cht.serie(column2))
                            .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)));
}

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

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

    Locale.setDefault(Locale.ENGLISH);

    rb.setPageFormat(PageType.A2, PageOrientation.PORTRAIT)
            .setTemplate(template().setChartValuePattern("#,##0.#").setChartPercentValuePattern("#,##0.###"))
            .columns(column1 = col.column("Column1", "field1", String.class),
                    column2 = col.column("Column2", "field2", Integer.class),
                    column3 = col.column("Column3", "field3", Integer.class))
            .summary(//from w ww .  j  a  va2  s. c o m
                    cmp.horizontalList(cht.barChart().setShowValues(true).setShowPercentages(true)
                            .setPercentValuePattern("#,##0.##").setCategory(column1)
                            .series(cht.serie(column2), cht.serie(column3)),
                            cht.bar3DChart().setShowValues(true).setShowPercentages(true).setCategory(column1)
                                    .series(cht.serie(column2), cht.serie(column3)),
                            cht.barChart().setShowValues(true).setValuePattern("#,##0.##").setCategory(column1)
                                    .series(cht.serie(column2), cht.serie(column3)),
                            cht.bar3DChart().setShowValues(true).setCategory(column1).series(cht.serie(column2),
                                    cht.serie(column3))),
                    cmp.horizontalList(
                            cht.pieChart().setShowValues(true).setValuePattern("#,##0.##")
                                    .setShowPercentages(true).setPercentValuePattern("#,##0.##").setKey(column1)
                                    .series(cht.serie(column2)),
                            cht.pieChart().setShowValues(true).setShowPercentages(true).setKey(column1)
                                    .series(cht.serie(column2))));
}

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

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

    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))
            .summary(/*from   w  ww  .  j a v  a 2s .c om*/
                    cht.timeSeriesChart().setTimePeriod(column1).series(cht.serie(column3))
                            .setTimePeriodType(TimePeriod.DAY).setShowShapes(false).setShowLines(false),
                    cht.timeSeriesChart().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.timeSeriesChart().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:de.grobox.liberario.activities.TransportrActivity.java

protected static void useLanguage(Context context) {
    String lang = Preferences.getLanguage(context);
    if (!lang.equals(context.getString(R.string.pref_language_value_default))) {
        Locale locale;/*from ww  w . j  av  a  2  s  .co m*/
        if (lang.contains("_")) {
            String[] lang_array = lang.split("_");
            locale = new Locale(lang_array[0], lang_array[1]);
        } else {
            locale = new Locale(lang);
        }
        Locale.setDefault(locale);
        Configuration config = context.getResources().getConfiguration();
        config.locale = locale;
        context.getResources().updateConfiguration(config, context.getResources().getDisplayMetrics());
    } else {
        // use default language
        context.getResources().updateConfiguration(Resources.getSystem().getConfiguration(),
                context.getResources().getDisplayMetrics());
    }
}

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

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

    Locale.setDefault(Locale.ENGLISH);

    rb.setPageFormat(PageType.A2, PageOrientation.PORTRAIT)
            .columns(column1 = col.column("Column1", "field1", String.class),
                    column2 = col.column("Column2", "field2", Integer.class),
                    column3 = col.column("Column3", "field3", Integer.class))
            .summary(//  w ww .  jav  a  2s.  co m
                    cmp.horizontalList(
                            cht.barChart().setShowValues(true).setShowPercentages(true).setCategory(column1)
                                    .series(cht.serie(column2), cht.serie(column3)),
                            cht.bar3DChart().setShowValues(true).setShowPercentages(true)
                                    .setPercentValuePattern("#,##0.#").setCategory(column1)
                                    .series(cht.serie(column2), cht.serie(column3)),
                            cht.stackedBarChart().setShowPercentages(true).setCategory(column1)
                                    .series(cht.serie(column2), cht.serie(column3)),
                            cht.stackedBar3DChart().setShowPercentages(true).setCategory(column1)
                                    .series(cht.serie(column2), cht.serie(column3)),
                            cht.areaChart().setShowPercentages(true).setCategory(column1)
                                    .series(cht.serie(column2), cht.serie(column3))),
                    cmp.horizontalList(
                            cht.stackedAreaChart().setShowPercentages(true).setCategory(column1)
                                    .series(cht.serie(column2), cht.serie(column3)),
                            cht.layeredBarChart().setShowPercentages(true).setCategory(column1)
                                    .series(cht.serie(column2), cht.serie(column3)),
                            cht.lineChart().setShowPercentages(true).setCategory(column1)
                                    .series(cht.serie(column2), cht.serie(column3))),
                    cht.pieChart().setShowPercentages(true).setPercentValuePattern("#,##0.#").setKey(column1)
                            .series(cht.serie(column2)),
                    cht.barChart().setShowValues(true).setShowPercentages(true).setCategory(column1)
                            .series(cht.serie(column2)).setDataSource(new DRDataSource()));
}

From source file:com.willwinder.universalgcodesender.i18n.Localization.java

/**
 * Loads the resource bundle with all translations for the given language and region
 *
 * @param language the language to load, ex: en, sv, de
 * @param region the region of the language to load, ex: US, SE, DE
 * @throws MissingResourceException if the resource bundle couldn't be found
 *///from   w w w .  ja  v a  2s  .c o m
private static void loadResourceBundle(String language, String region) throws MissingResourceException {
    Localization.region = region;
    Locale locale = new Locale(language, region);
    Locale.setDefault(locale);
    bundle = ResourceBundle.getBundle("resources.MessagesBundle", locale);
}

From source file:org.springframework.boot.logging.java.JavaLoggingSystemTests.java

@After
public void clearLocale() {
    Locale.setDefault(this.defaultLocale);
}

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

@Override
protected void configureReport(JasperReportBuilder rb) {
    TextColumnBuilder<String> column1;
    TextColumnBuilder<Date> column2;
    TextColumnBuilder<Double> column3;
    TextColumnBuilder<Double> column4;
    TextColumnBuilder<Double> column5;
    TextColumnBuilder<Double> column6;
    TextColumnBuilder<Double> column7;

    Locale.setDefault(Locale.ENGLISH);

    rb.columns(column1 = col.column("Column1", "field1", String.class),
            column2 = col.column("Column2", "field2", Date.class),
            column3 = col.column("Column3", "field3", Double.class),
            column4 = col.column("Column4", "field4", Double.class),
            column5 = col.column("Column5", "field5", Double.class),
            column6 = col.column("Column6", "field6", Double.class),
            column7 = col.column("Column7", "field7", Double.class))
            .summary(//from  w w w. j av  a  2s .c o  m
                    cht.highLowChart().setSeries(column1).setDate(column2).setHigh(column3).setLow(column4)
                            .setOpen(column5).setClose(column6).setVolume(column7).setShowOpenTicks(true)
                            .setShowCloseTicks(true),
                    cht.highLowChart().setSeries(column1).setDate(column2).setHigh(column3).setLow(column4)
                            .setOpen(column5).setClose(column6).setVolume(column7)
                            .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.highLowChart().setSeries(column1).setDate(column2).setHigh(column3).setLow(column4)
                            .setOpen(column5).setClose(column6).setVolume(column7)
                            .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:net.sf.dynamicreports.test.jasper.chart.CandlestickChartTest.java

@Override
protected void configureReport(JasperReportBuilder rb) {
    TextColumnBuilder<String> column1;
    TextColumnBuilder<Date> column2;
    TextColumnBuilder<Double> column3;
    TextColumnBuilder<Double> column4;
    TextColumnBuilder<Double> column5;
    TextColumnBuilder<Double> column6;
    TextColumnBuilder<Double> column7;

    Locale.setDefault(Locale.ENGLISH);

    rb.columns(column1 = col.column("Column1", "field1", String.class),
            column2 = col.column("Column2", "field2", Date.class),
            column3 = col.column("Column3", "field3", Double.class),
            column4 = col.column("Column4", "field4", Double.class),
            column5 = col.column("Column5", "field5", Double.class),
            column6 = col.column("Column6", "field6", Double.class),
            column7 = col.column("Column7", "field7", Double.class))
            .summary(// w  w w  .  j a v  a2s  . c  o  m
                    cht.candlestickChart().setSeries(column1).setDate(column2).setHigh(column3).setLow(column4)
                            .setOpen(column5).setClose(column6).setVolume(column7).setShowVolume(false),
                    cht.candlestickChart().setSeries(column1).setDate(column2).setHigh(column3).setLow(column4)
                            .setOpen(column5).setClose(column6).setVolume(column7)
                            .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.candlestickChart().setSeries(column1).setDate(column2).setHigh(column3).setLow(column4)
                            .setOpen(column5).setClose(column6).setVolume(column7)
                            .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)));
}