List of usage examples for java.text NumberFormat getCurrencyInstance
public static final NumberFormat getCurrencyInstance()
From source file:com.concursive.connect.config.ApplicationPrefs.java
/** * Description of the Method//from w w w .java 2 s. c o m * * @param context Description of the Parameter */ public void configureDefaultBehavior(ServletContext context) { LOG.info("Configuring default behavior..."); // Default login and session validation if (!this.has(LOGIN_MODE)) { this.add(LOGIN_MODE, "Default"); } // Detect if this instance is using a legacy default, and upgrade to a theme if (!this.has(THEME)) { if (!this.has(JSP_TEMPLATE) || "/layoutDefault.jsp".equals(this.get(JSP_TEMPLATE))) { this.add(THEME, "default"); this.add(COLOR_SCHEME, "dark_blue"); } } // Determine the site theme if (this.has(THEME)) { // Use a theme and its color scheme; always use the default if the theme is missing String theme = "default"; String colorScheme = "dark_blue"; Set<String> themeFiles = context.getResourcePaths("/themes/" + this.get(THEME) + "/color-schemes"); if (themeFiles != null && themeFiles.size() > 0) { for (String thisFile : themeFiles) { if (thisFile.startsWith( "/themes/" + this.get(THEME) + "/color-schemes/" + this.get(COLOR_SCHEME))) { theme = this.get(THEME); colorScheme = this.get(COLOR_SCHEME); } } } if (!theme.equals(get(THEME))) { LOG.error("The theme (" + get(THEME) + ") and color scheme (" + get(COLOR_SCHEME) + ") could not be found, using default theme"); } addParameter(context, Constants.TEMPLATE_THEME, theme); addParameter(context, Constants.TEMPLATE_COLOR_SCHEME, colorScheme); // Determine the layout (or use the default layout) String layout = "default"; Set<String> layoutFiles = context.getResourcePaths("/themes/" + this.get(THEME) + "/jsp/"); if (layoutFiles != null && layoutFiles.size() > 0) { for (String thisFile : layoutFiles) { if (("/themes/" + this.get(THEME) + "/jsp/layout.jsp").equals(thisFile)) { layout = this.get(THEME); } } } if ("default".equals(layout) && !"default".equals(this.get(THEME))) { try { // Check for a compiled layout Class.forName("org.apache.jsp.themes." + JspUtils.makeJavaIdentifier(this.get(THEME)) + ".jsp.layout_jsp"); layout = this.get(THEME); } catch (Exception e) { LOG.info("Using default theme: " + e.getMessage()); } } addParameter(context, Constants.TEMPLATE_LAYOUT, "/themes/" + layout + "/jsp/layout.jsp"); LOG.info("THEME: " + get(THEME)); LOG.info(" COLOR SCHEME: " + get(COLOR_SCHEME)); LOG.info(" LAYOUT: " + "/themes/" + layout + "/jsp/layout.jsp"); } else { // Use the specified template addParameter(context, Constants.TEMPLATE_LAYOUT, this.get(JSP_TEMPLATE)); // Default CSS for all items on page addParameter(context, Constants.TEMPLATE_CSS, this.get(CSS_FILE)); } // Default color scheme for themeable items (deprecated) if (this.has("SKIN")) { addParameter(context, "SKIN", this.get("SKIN")); } else { addParameter(context, "SKIN", "blue"); this.add("SKIN", "blue"); } // Application Settings if (!this.has(USERS_CAN_REGISTER)) { this.add(USERS_CAN_REGISTER, "true"); } if (!this.has(USERS_CAN_INVITE)) { this.add(USERS_CAN_INVITE, "true"); } if (!this.has(SHOW_TERMS_AND_CONDITIONS)) { this.add(SHOW_TERMS_AND_CONDITIONS, "true"); } if (!this.has(USERS_CAN_START_PROJECTS)) { this.add(USERS_CAN_START_PROJECTS, "false"); } if (!this.has(USERS_ARE_ANONYMOUS)) { this.add(USERS_ARE_ANONYMOUS, "false"); } if (!this.has(SEARCH_USES_LOCATION)) { this.add(SEARCH_USES_LOCATION, "true"); } if (!this.has(SHOW_HOLIDAYS)) { this.add(SHOW_HOLIDAYS, "true"); } // Portal if (!this.has(HOME_URL)) { this.add(HOME_URL, "index.shtml"); } else if ("Portal.do?command=Default".equals(this.get(HOME_URL))) { this.add(HOME_URL, "index.shtml"); } if (!this.has("PORTAL")) { this.add("PORTAL", "true"); } if (!this.has(WEB_PAGE_TITLE)) { this.add(WEB_PAGE_TITLE, ApplicationVersion.TITLE); } if (!this.has(LANGUAGE)) { this.add(LANGUAGE, "en_US"); } if (!this.has(TIMEZONE)) { this.add(TIMEZONE, TimeZone.getDefault().getID()); } if (!this.has(CURRENCY)) { this.add(CURRENCY, NumberFormat.getCurrencyInstance().getCurrency().getCurrencyCode()); } if (!this.has(LANGUAGES_SUPPORTED)) { this.add(LANGUAGES_SUPPORTED, "en_US"); } if (!this.has(MAIN_PROFILE)) { this.add(MAIN_PROFILE, "main-profile"); } // Dimdim service if (!this.has(DIMDIM_ENABLED)) { this.add(DIMDIM_ENABLED, "false"); } if (!this.has(DIMDIM_API_DOMAIN)) { // @note Dimdim public API is no longer available //this.add(DIMDIM_API_DOMAIN, "http://webmeeting.dimdim.com/portal"); } }
From source file:facturas.Facture.java
private void jButtonPrecioTotalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPrecioTotalActionPerformed /*Inroducimos un sonido para que se reproduzca a la hora de realizar la accin del botn.*//* w w w. jav a2 s .c o m*/ try { Player player = new Player(getClass().getResourceAsStream("/sounds/BubblePo.mp3")); player.play(); player.close(); } catch (Exception e) { System.out.println("Error al reproducir el audio"); } /*Realizamos las distintas operaciones para averiguar el coste total de los productos con su respectivo importe del iva.*/ final double IVA = 0.21; float price = Float.valueOf(jTextFieldPrice.getText()); int units = Integer.valueOf(jTextFieldUnits.getText()); float iva = (float) (price * units * IVA); NumberFormat ivaFormat = NumberFormat.getCurrencyInstance(); jTextFieldIva.setText(String.valueOf(ivaFormat.format(iva))); float total = ((price * units) + iva); NumberFormat amountFormat = NumberFormat.getCurrencyInstance(); jTextFieldTotal.setText(String.valueOf(amountFormat.format(total))); float price1 = Float.valueOf(jTextFieldPrice1.getText()); int units1 = Integer.valueOf(jTextFieldUnits1.getText()); float iva1 = (float) (price1 * units1 * IVA); NumberFormat ivaFormat1 = NumberFormat.getCurrencyInstance(); jTextFieldIva1.setText(String.valueOf(ivaFormat1.format(iva1))); float total1 = (price1 * units1) + iva1; NumberFormat amountFormat1 = NumberFormat.getCurrencyInstance(); jTextFieldTotal1.setText(String.valueOf(amountFormat1.format(total1))); float price2 = Float.valueOf(jTextFieldPrice2.getText()); int units2 = Integer.valueOf(jTextFieldUnits2.getText()); float iva2 = (float) (price2 * units2 * IVA); NumberFormat ivaFormat2 = NumberFormat.getCurrencyInstance(); jTextFieldIva2.setText(String.valueOf(ivaFormat2.format(iva2))); float total2 = (price2 * units2) + iva2; NumberFormat amountFormat2 = NumberFormat.getCurrencyInstance(); jTextFieldTotal2.setText(String.valueOf(amountFormat2.format(total2))); float price3 = Float.valueOf(jTextFieldPrice3.getText()); int units3 = Integer.valueOf(jTextFieldUnits3.getText()); float iva3 = (float) (price3 * units3 * IVA); NumberFormat ivaFormat3 = NumberFormat.getCurrencyInstance(); jTextFieldIva3.setText(String.valueOf(ivaFormat3.format(iva3))); float total3 = (price3 * units3) + iva3; NumberFormat amountFormat3 = NumberFormat.getCurrencyInstance(); jTextFieldTotal3.setText(String.valueOf(amountFormat3.format(total3))); //Con esto tenemos la suma total de todos los precios. float totalEuros = total + total1 + total2 + total3; NumberFormat totalFormat = NumberFormat.getCurrencyInstance(); jTextFieldTotalPrice.setText(String.valueOf(totalFormat.format(totalEuros))); EmailValidator emailValidator = EmailValidator.getInstance(); boolean emailValid = emailValidator.isValid(jTextFieldEmail.getText()); String mensaje = emailValid ? "Email vlido" : "Email no vlido"; System.out.println(mensaje); }
From source file:stockit.Manager.java
private void displayBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_displayBtnActionPerformed // TODO add your handling code here: //panel.removeAll(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); int row = table.getSelectedRow(); if (row != -1) { //dataset.setValue(, "", table.getValueAt(0,1).toString()); String selectedStock = table.getValueAt(row, 0).toString(); try {/*from w w w .ja v a 2s.com*/ DBConnection dbcon = new DBConnection(); dbcon.establishConnection(); Statement stmt = dbcon.con.createStatement(); ResultSet rs = stmt .executeQuery("Select stock_daily_performance.Closing_Price, stock_daily_performance.Date\n" + "FROM stock_daily_performance, stock\n" + "WHERE stock_daily_performance.StockID = stock.StockID AND stock.StockID = '" + selectedStock + "'" + "AND Date IN\n" + "( Select * from\n" + "(\n" + "SELECT Date \n" + "FROM stock_daily_performance \n" + "WHERE StockID = stockID \n" + "ORDER BY Date ASC\n" + ") temp_table)\n" + " "); while (rs.next()) { String formattedDate = rs.getString("Date"); int closing_price = rs.getInt("Closing_Price"); System.out.println("Closing Price: " + closing_price); System.out.println("Date: " + formattedDate); dataset.setValue(closing_price, "value", formattedDate); } dbcon.con.close(); } catch (Exception ex) { Logger.getLogger(clientLogin.class.getName()).log(Level.SEVERE, null, ex); } String stockName = table.getValueAt(row, 1).toString(); JFreeChart chart = ChartFactory.createBarChart3D(stockName + " Stock Performance", "Date", "Value", dataset, PlotOrientation.VERTICAL, false, false, false); Color c = new Color(240, 240, 240, 0); chart.setBackgroundPaint(c); CategoryPlot catPlot = chart.getCategoryPlot(); catPlot.setRangeGridlinePaint(Color.BLACK); //set interval of Y-axis ticks (tick every 5 units) NumberAxis yAxis = (NumberAxis) catPlot.getRangeAxis(); yAxis.setTickUnit(new NumberTickUnit(5)); //set y-axis labels as currency types ($) NumberFormat currency = NumberFormat.getCurrencyInstance(); yAxis.setNumberFormatOverride(currency); //setting number of lines an x-axis label is displayed on CategoryAxis categoryAxis = catPlot.getDomainAxis(); categoryAxis.setMaximumCategoryLabelLines(4); panel.setLayout(new java.awt.BorderLayout()); ChartPanel chartPanel = new ChartPanel(chart); panel.removeAll(); panel.add(chartPanel, BorderLayout.CENTER); panel.validate(); panel.repaint(); } }
From source file:com.concursive.connect.web.modules.wiki.utils.WikiPDFUtils.java
public static String getFieldValue(WikiPDFContext context, CustomFormField field) { // Return output based on type switch (field.getType()) { case CustomFormField.TEXTAREA: return StringUtils.replace(field.getValue(), "^", CRLF); case CustomFormField.SELECT: return field.getValue(); case CustomFormField.CHECKBOX: if ("true".equals(field.getValue())) { return "Yes"; } else {//from w w w . ja va2 s. c o m return "No"; } case CustomFormField.CALENDAR: String calendarValue = field.getValue(); if (StringUtils.hasText(calendarValue)) { try { String convertedDate = DateUtils.getUserToServerDateTimeString(null, DateFormat.SHORT, DateFormat.LONG, field.getValue()); Timestamp timestamp = DatabaseUtils.parseTimestamp(convertedDate); Locale locale = Locale.getDefault(); int dateFormat = DateFormat.SHORT; SimpleDateFormat dateFormatter = (SimpleDateFormat) SimpleDateFormat.getDateInstance(dateFormat, locale); calendarValue = dateFormatter.format(timestamp); } catch (Exception e) { LOG.error(e); } } return calendarValue; case CustomFormField.PERCENT: return field.getValue() + "%"; case CustomFormField.INTEGER: // Determine the value to display in the field String integerValue = StringUtils.toHtmlValue(field.getValue()); if (StringUtils.hasText(integerValue)) { try { NumberFormat formatter = NumberFormat.getInstance(); integerValue = formatter.format(StringUtils.getIntegerNumber(field.getValue())); } catch (Exception e) { LOG.warn("Could not integer format: " + field.getValue()); } } return integerValue; case CustomFormField.FLOAT: // Determine the value to display in the field String decimalValue = field.getValue(); if (StringUtils.hasText(decimalValue)) { try { NumberFormat formatter = NumberFormat.getInstance(); decimalValue = formatter.format(StringUtils.getDoubleNumber(field.getValue())); } catch (Exception e) { LOG.warn("Could not decimal format: " + field.getValue()); } } return decimalValue; case CustomFormField.CURRENCY: // Use a currency for formatting String currencyCode = field.getValueCurrency(); if (currencyCode == null) { currencyCode = field.getCurrency(); } if (!StringUtils.hasText(currencyCode)) { currencyCode = "USD"; } try { NumberFormat formatter = NumberFormat.getCurrencyInstance(); if (currencyCode != null) { Currency currency = Currency.getInstance(currencyCode); formatter.setCurrency(currency); } return (formatter.format(StringUtils.getDoubleNumber(field.getValue()))); } catch (Exception e) { LOG.error(e.getMessage()); } return field.getValue(); case CustomFormField.EMAIL: return field.getValue(); case CustomFormField.PHONE: PhoneNumberBean phone = new PhoneNumberBean(); phone.setNumber(field.getValue()); PhoneNumberUtils.format(phone, Locale.getDefault()); return phone.toString(); case CustomFormField.URL: String value = StringUtils.toHtmlValue(field.getValue()); if (StringUtils.hasText(value)) { if (!value.contains("://")) { value = "http://" + value; } if (value.contains("://")) { return value; } } return value; case CustomFormField.IMAGE: String image = field.getValue(); if (StringUtils.hasText(image)) { return "WikiImage:" + image; } return image; default: return field.getValue(); } }
From source file:com.concursive.connect.web.modules.wiki.utils.WikiToHTMLUtils.java
public static String toHtml(CustomFormField field, Wiki wiki, String contextPath) { // Return output based on type switch (field.getType()) { case CustomFormField.TEXTAREA: String textAreaValue = StringUtils.replace(field.getValue(), "^", CRLF); return StringUtils.toHtml(textAreaValue); case CustomFormField.SELECT: return StringUtils.toHtml(field.getValue()); case CustomFormField.CHECKBOX: if ("true".equals(field.getValue())) { return "Yes"; } else {/*from w ww . ja v a 2s. com*/ return "No"; } case CustomFormField.CALENDAR: String calendarValue = field.getValue(); if (StringUtils.hasText(calendarValue)) { try { String convertedDate = DateUtils.getUserToServerDateTimeString(null, DateFormat.SHORT, DateFormat.LONG, field.getValue()); Timestamp timestamp = DatabaseUtils.parseTimestamp(convertedDate); Locale locale = Locale.getDefault(); int dateFormat = DateFormat.SHORT; SimpleDateFormat dateFormatter = (SimpleDateFormat) SimpleDateFormat.getDateInstance(dateFormat, locale); calendarValue = dateFormatter.format(timestamp); } catch (Exception e) { LOG.error("toHtml calendar", e); } } return StringUtils.toHtml(calendarValue); case CustomFormField.PERCENT: return StringUtils.toHtml(field.getValue()) + "%"; case CustomFormField.INTEGER: // Determine the value to display in the field String integerValue = StringUtils.toHtmlValue(field.getValue()); if (StringUtils.hasText(integerValue)) { try { NumberFormat formatter = NumberFormat.getInstance(); integerValue = formatter.format(StringUtils.getIntegerNumber(field.getValue())); } catch (Exception e) { LOG.warn("Could not integer format: " + field.getValue()); } } return integerValue; case CustomFormField.FLOAT: // Determine the value to display in the field String decimalValue = StringUtils.toHtmlValue(field.getValue()); if (StringUtils.hasText(decimalValue)) { try { NumberFormat formatter = NumberFormat.getInstance(); decimalValue = formatter.format(StringUtils.getDoubleNumber(field.getValue())); } catch (Exception e) { LOG.warn("Could not decimal format: " + field.getValue()); } } return decimalValue; case CustomFormField.CURRENCY: // Use a currency for formatting String currencyCode = field.getValueCurrency(); if (currencyCode == null) { currencyCode = field.getCurrency(); } if (!StringUtils.hasText(currencyCode)) { currencyCode = "USD"; } try { NumberFormat formatter = NumberFormat.getCurrencyInstance(); if (currencyCode != null) { Currency currency = Currency.getInstance(currencyCode); formatter.setCurrency(currency); } return (StringUtils.toHtml(formatter.format(StringUtils.getDoubleNumber(field.getValue())))); } catch (Exception e) { LOG.error("toHtml currency", e); } return StringUtils.toHtml(field.getValue()); case CustomFormField.EMAIL: return StringUtils.toHtml(field.getValue()); case CustomFormField.PHONE: PhoneNumberBean phone = new PhoneNumberBean(); phone.setNumber(field.getValue()); PhoneNumberUtils.format(phone, Locale.getDefault()); return StringUtils.toHtml(phone.toString()); case CustomFormField.URL: String value = StringUtils.toHtmlValue(field.getValue()); if (StringUtils.hasText(value)) { if (!value.contains("://")) { value = "http://" + value; } if (value.contains("://")) { return ("<a href=\"" + StringUtils.toHtml(value) + "\">" + StringUtils.toHtml(value) + "</a>"); } } return StringUtils.toHtml(value); case CustomFormField.IMAGE: String image = StringUtils.toHtmlValue(field.getValue()); if (StringUtils.hasText(image)) { Project project = ProjectUtils.loadProject(wiki.getProjectId()); return ("<img src=\"" + contextPath + "/show/" + project.getUniqueId() + "/wiki-image/" + image + "\"/>"); } return StringUtils.toHtml(image); default: return StringUtils.toHtml(field.getValue()); } }
From source file:com.naryx.tagfusion.cfm.tag.awt.cfCHART.java
private JFreeChart renderPieChart(cfSession _Session, cfCHARTInternalData chartData, List<cfCHARTSERIESData> series, String tipStyle, String drillDownUrl) throws cfmRunTimeException { // Retrieve the attributes of the chart String backgroundColorStr = getDynamic(_Session, "BACKGROUNDCOLOR").toString(); Color backgroundColor = convertStringToColor(backgroundColorStr); String foregroundColorStr = getDynamic(_Session, "FOREGROUNDCOLOR").toString(); Color foregroundColor = convertStringToColor(foregroundColorStr); String labelFormat = getDynamic(_Session, "LABELFORMAT").toString().toLowerCase(); if (!labelFormat.equals("number") && !labelFormat.equals("currency") && !labelFormat.equals("percent")) throw newRunTimeException( "The labelFormat value '" + labelFormat + "' is not supported with pie charts"); String pieSliceStyle = getDynamic(_Session, "PIESLICESTYLE").toString().toLowerCase(); String title = null;/*from w w w .j a v a 2 s . c om*/ if (containsAttribute("TITLE")) title = getDynamic(_Session, "TITLE").toString(); Font font = getFont(_Session); cfCHARTSERIESData seriesData = series.get(0); boolean bShow3D = getDynamic(_Session, "SHOW3D").getBoolean(); if (bShow3D && !seriesData.getType().equals("pie")) throw newRunTimeException("Only bar, line, horizontal bar and pie charts can be displayed in 3D"); boolean bShowBorder = getDynamic(_Session, "SHOWBORDER").getBoolean(); boolean bShowLegend = true; // default to true for pie charts if (containsAttribute("SHOWLEGEND")) bShowLegend = getDynamic(_Session, "SHOWLEGEND").getBoolean(); // Get the plot for the chart and configure it PiePlot plot = getPiePlot(series, pieSliceStyle, bShow3D); setBackgroundImage(_Session, plot, chartData.getImageData()); plot.setBackgroundPaint(backgroundColor); plot.setLabelBackgroundPaint(backgroundColor); plot.setLabelShadowPaint(backgroundColor); // Set the labels color plot.setLabelPaint(convertStringToColor(seriesData.getDataLabelColor())); // Set the labels font plot.setLabelFont(getFont(seriesData.getDataLabelFont(), seriesData.getDataLabelFontBold(), seriesData.getDataLabelFontItalic(), seriesData.getDataLabelFontSize())); String dataLabelStyle = seriesData.getDataLabelStyle(); NumberFormat percentInstance = NumberFormat.getPercentInstance(); percentInstance.setMaximumFractionDigits(3); NumberFormat numberFormat = null; if (labelFormat.equals("number")) { // Only display the value in the Label as a number numberFormat = NumberFormat.getInstance(); if (dataLabelStyle.equals("none")) plot.setLabelGenerator(null); else if (dataLabelStyle.equals("value")) plot.setLabelGenerator(new org.jfree.chart.labels.StandardPieSectionLabelGenerator("{1}")); else if (dataLabelStyle.equals("rowlabel")) plot.setLabelGenerator( new org.jfree.chart.labels.StandardPieSectionLabelGenerator(seriesData.getSeriesLabel())); else if (dataLabelStyle.equals("columnlabel")) plot.setLabelGenerator(new org.jfree.chart.labels.StandardPieSectionLabelGenerator("{0}")); else if (dataLabelStyle.equals("pattern")) plot.setLabelGenerator( new org.jfree.chart.labels.StandardPieSectionLabelGenerator("{0} {1} ({2} of {3})")); else { String pattern = java.text.MessageFormat.format(dataLabelStyle, new Object[] { seriesData.getSeriesLabel(), "{0}", "{1}", "{2}", "{3}" }); plot.setLabelGenerator(new org.jfree.chart.labels.StandardPieSectionLabelGenerator(pattern)); } } else if (labelFormat.equals("currency")) { // Only display the value in the Label as a currency numberFormat = NumberFormat.getCurrencyInstance(); if (dataLabelStyle.equals("none")) plot.setLabelGenerator(null); else if (dataLabelStyle.equals("value")) plot.setLabelGenerator(new org.jfree.chart.labels.StandardPieSectionLabelGenerator("{1}", NumberFormat.getCurrencyInstance(), percentInstance)); else if (dataLabelStyle.equals("rowlabel")) plot.setLabelGenerator( new org.jfree.chart.labels.StandardPieSectionLabelGenerator(seriesData.getSeriesLabel())); else if (dataLabelStyle.equals("columnlabel")) plot.setLabelGenerator(new org.jfree.chart.labels.StandardPieSectionLabelGenerator("{0}")); else if (dataLabelStyle.equals("pattern")) plot.setLabelGenerator(new org.jfree.chart.labels.StandardPieSectionLabelGenerator( "{0} {1} ({2} of {3})", NumberFormat.getCurrencyInstance(), percentInstance)); else { String pattern = java.text.MessageFormat.format(dataLabelStyle, new Object[] { seriesData.getSeriesLabel(), "{0}", "{1}", "{2}", "{3}" }); plot.setLabelGenerator(new org.jfree.chart.labels.StandardPieSectionLabelGenerator(pattern, NumberFormat.getCurrencyInstance(), percentInstance)); } } else if (labelFormat.equals("percent")) { // Only display the value in the Label as a percent numberFormat = percentInstance; if (dataLabelStyle.equals("none")) plot.setLabelGenerator(null); else if (dataLabelStyle.equals("value")) plot.setLabelGenerator(new org.jfree.chart.labels.StandardPieSectionLabelGenerator("{1}", percentInstance, percentInstance)); else if (dataLabelStyle.equals("rowlabel")) plot.setLabelGenerator( new org.jfree.chart.labels.StandardPieSectionLabelGenerator(seriesData.getSeriesLabel())); else if (dataLabelStyle.equals("columnlabel")) plot.setLabelGenerator(new org.jfree.chart.labels.StandardPieSectionLabelGenerator("{0}")); else if (dataLabelStyle.equals("pattern")) plot.setLabelGenerator(new org.jfree.chart.labels.StandardPieSectionLabelGenerator( "{0} {1} ({2} of {3})", percentInstance, percentInstance)); else { String pattern = java.text.MessageFormat.format(dataLabelStyle, new Object[] { seriesData.getSeriesLabel(), "{0}", "{1}", "{2}", "{3}" }); plot.setLabelGenerator(new org.jfree.chart.labels.StandardPieSectionLabelGenerator(pattern, percentInstance, percentInstance)); } } if (!tipStyle.equals("none")) { plot.setToolTipGenerator(new StandardPieToolTipGenerator( StandardPieToolTipGenerator.DEFAULT_SECTION_LABEL_FORMAT, numberFormat, numberFormat)); } if (drillDownUrl != null) { plot.setURLGenerator(new com.newatlanta.bluedragon.PieURLGenerator(drillDownUrl, numberFormat)); } // Get the chart and configure it JFreeChart chart = new JFreeChart(null, null, plot, false); chart.setBorderVisible(bShowBorder); chart.setBackgroundPaint(backgroundColor); setTitle(chart, title, font, foregroundColor, chartData.getTitles()); setLegend(chart, bShowLegend, font, foregroundColor, backgroundColor, chartData.getLegendData()); return chart; }
From source file:com.naryx.tagfusion.cfm.tag.awt.cfCHART.java
private CategoryPlot getCategoryPlot(List<cfCHARTSERIESData> series, String xAxisTitle, String yAxisTitle, String labelFormat, boolean bShowMarkers, int markerSize, boolean bShow3D, String tipStyle, String drillDownUrl, int xOffset, int yOffset, int yAxisUnits, String seriesPlacement, boolean bSortXAxis, int height, String[] yAxisSymbols, int gridLines) throws cfmRunTimeException { // Create a category plot CategoryPlot plot = new CategoryPlot(); // Set the domain axis (the x-axis) org.jfree.chart.axis.CategoryAxis categoryAxis; if (bShow3D)// w w w . ja v a 2 s . com categoryAxis = new CategoryAxis3D(xAxisTitle); else categoryAxis = new CategoryAxis(xAxisTitle); plot.setDomainAxis(categoryAxis); // Set the range axis (the y-axis) ValueAxis valueAxis; DateFormat dateFormat = null; NumberFormat numberFormat = null; // Ignore a label format of date if the y-axis is using symbols if (labelFormat.equals("date") && (yAxisSymbols == null)) { valueAxis = new DateAxis(yAxisTitle); dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); ((DateAxis) valueAxis).setDateFormatOverride(dateFormat); } else { if (yAxisSymbols != null) { valueAxis = new SymbolAxis(yAxisTitle, yAxisSymbols); ((SymbolAxis) valueAxis).setGridBandsVisible(false); ((SymbolAxis) valueAxis).setAutoRangeStickyZero(true); } else if (bShow3D) { valueAxis = new NumberAxis3D(yAxisTitle); } else { valueAxis = new NumberAxis(yAxisTitle); } if (labelFormat.equals("currency")) { ((NumberAxis) valueAxis).setNumberFormatOverride(NumberFormat.getCurrencyInstance()); numberFormat = NumberFormat.getCurrencyInstance(); } else if (labelFormat.equals("percent")) { numberFormat = NumberFormat.getPercentInstance(); numberFormat.setMaximumFractionDigits(3); // without this change .11443 // would be displayed as 11% // instead of 11.443% ((NumberAxis) valueAxis).setNumberFormatOverride(numberFormat); } else { numberFormat = NumberFormat.getInstance(); } if (yAxisUnits != 0) ((NumberAxis) valueAxis).setTickUnit(new NumberTickUnit(yAxisUnits)); } plot.setRangeAxis(valueAxis); // Add a dataset and renderer for each series int barChartDatasetIndex = -1; int hBarChartDatasetIndex = -1; int num = 0; MinMaxData minMax = new MinMaxData(); for (int i = 0; i < series.size(); i++) { cfCHARTSERIESData seriesData = series.get(i); // If the sortXAxis attribute was set to "yes" then sort the data. // NOTE: this attribute is only used with category charts. if (bSortXAxis) seriesData.sort(); DefaultCategoryDataset dataset; if ((barChartDatasetIndex != -1) && (seriesData.getType().equals("bar"))) { dataset = (DefaultCategoryDataset) plot.getDataset(barChartDatasetIndex); addSeriesDataToDataset(seriesData, dataset, minMax); // Set the paint style for this series setPaintStyle(seriesData.getPaintStyle(), plot.getRenderer(barChartDatasetIndex), dataset.getRowCount() - 1, height); // Add the color list for this series to the custom color renderer CustomColorRenderer cr = (CustomColorRenderer) plot.getRenderer(barChartDatasetIndex); cr.addColors(getColorList(seriesData)); continue; } else if ((hBarChartDatasetIndex != -1) && (seriesData.getType().equals("horizontalbar"))) { dataset = (DefaultCategoryDataset) plot.getDataset(hBarChartDatasetIndex); addSeriesDataToDataset(seriesData, dataset, minMax); // Set the paint style for this series setPaintStyle(seriesData.getPaintStyle(), plot.getRenderer(hBarChartDatasetIndex), dataset.getRowCount() - 1, height); // Add the color list for this series to the custom color renderer CustomColorRenderer cr = (CustomColorRenderer) plot.getRenderer(hBarChartDatasetIndex); cr.addColors(getColorList(seriesData)); continue; } else { dataset = new DefaultCategoryDataset(); addSeriesDataToDataset(seriesData, dataset, minMax); } plot.setDataset(num, dataset); AbstractCategoryItemRenderer renderer = null; if (seriesData.getType().equals("bar")) { plot.setOrientation(PlotOrientation.VERTICAL); renderer = getBarRenderer(seriesPlacement, bShow3D, xOffset, yOffset, getColorList(seriesData)); ItemLabelPosition position1 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER); renderer.setPositiveItemLabelPosition(position1); ItemLabelPosition position2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER); renderer.setNegativeItemLabelPosition(position2); ((BarRenderer) renderer).setItemMargin(0.0); // The margin between items // in the same category categoryAxis.setCategoryMargin(0.2); // The margin between each category barChartDatasetIndex = num; } else if (seriesData.getType().equals("horizontalbar")) { plot.setOrientation(PlotOrientation.HORIZONTAL); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); renderer = getBarRenderer(seriesPlacement, bShow3D, xOffset, yOffset, getColorList(seriesData)); if (bShow3D) { // change rendering order to ensure that bar overlapping is the // right way around plot.setRowRenderingOrder(org.jfree.util.SortOrder.DESCENDING); plot.setColumnRenderingOrder(org.jfree.util.SortOrder.DESCENDING); } ItemLabelPosition position1 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_LEFT); renderer.setPositiveItemLabelPosition(position1); ItemLabelPosition position2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE9, TextAnchor.CENTER_RIGHT); renderer.setNegativeItemLabelPosition(position2); ((BarRenderer) renderer).setItemMargin(0.0); // The margin between items // in the same category categoryAxis.setCategoryMargin(0.2); // The margin between each category hBarChartDatasetIndex = num; } else if (seriesData.getType().equals("line")) { if (bShow3D) { renderer = new LineRenderer3D(); ((LineRenderer3D) renderer).setXOffset(xOffset); ((LineRenderer3D) renderer).setYOffset(yOffset); } else { renderer = new LineAndShapeRenderer(true, false); } // Enable/Disable displaying of markers ((LineAndShapeRenderer) renderer).setShapesVisible(bShowMarkers); // Set the shape of the markers based on the markerSize value ((LineAndShapeRenderer) renderer).setShape(getMarker(seriesData.getMarkerStyle(), markerSize)); } else if (seriesData.getType().equals("area")) { if (seriesPlacement.equals("stacked")) renderer = new StackedAreaRenderer(); // this doesn't work for some // reason else renderer = new AreaRenderer(); // Truncate the first and last values to match CFMX 7 ((AreaRenderer) renderer).setEndType(AreaRendererEndType.TRUNCATE); categoryAxis.setCategoryMargin(0.0); } else if (seriesData.getType().equals("step")) { renderer = new CategoryStepRenderer(true); } else if (seriesData.getType().equals("scatter")) { renderer = new LineAndShapeRenderer(false, true); // Set the shape of the markers based on the markerSize value ((LineAndShapeRenderer) renderer).setShape(getMarker(seriesData.getMarkerStyle(), markerSize)); } if (!tipStyle.equals("none")) { if (dateFormat != null) renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator("({0}, {1}) = {2}", dateFormat)); else renderer.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator("({0}, {1}) = {2}", numberFormat)); } if (drillDownUrl != null) { if (dateFormat != null) renderer.setBaseItemURLGenerator( new com.newatlanta.bluedragon.CategoryURLGenerator(drillDownUrl, dateFormat)); else renderer.setBaseItemURLGenerator( new com.newatlanta.bluedragon.CategoryURLGenerator(drillDownUrl, numberFormat)); } if (seriesData.getSeriesColor() != null) renderer.setSeriesPaint(0, convertStringToColor(seriesData.getSeriesColor())); String dataLabelStyle = seriesData.getDataLabelStyle(); if (labelFormat.equals("date")) { if (dataLabelStyle.equals("none")) { renderer.setItemLabelsVisible(false); } else { setCategoryItemLabelsData(renderer, seriesData); if (dataLabelStyle.equals("value")) renderer.setItemLabelGenerator( new CategoryItemLabelGenerator("{2}", dateFormat, yAxisSymbols)); else if (dataLabelStyle.equals("rowlabel")) renderer.setItemLabelGenerator( new CategoryItemLabelGenerator("{0}", dateFormat, yAxisSymbols)); else if (dataLabelStyle.equals("columnlabel")) renderer.setItemLabelGenerator( new CategoryItemLabelGenerator("{1}", dateFormat, yAxisSymbols)); else if (dataLabelStyle.equals("pattern")) renderer.setItemLabelGenerator( new CategoryItemLabelGenerator("{1} {2}", dateFormat, yAxisSymbols)); else renderer.setItemLabelGenerator( new CategoryItemLabelGenerator(dataLabelStyle, dateFormat, yAxisSymbols)); } } else { if (dataLabelStyle.equals("none")) { renderer.setItemLabelsVisible(false); } else { setCategoryItemLabelsData(renderer, seriesData); if (dataLabelStyle.equals("value")) renderer.setItemLabelGenerator( new CategoryItemLabelGenerator("{2}", numberFormat, yAxisSymbols)); else if (dataLabelStyle.equals("rowlabel")) renderer.setItemLabelGenerator( new CategoryItemLabelGenerator("{0}", numberFormat, yAxisSymbols)); else if (dataLabelStyle.equals("columnlabel")) renderer.setItemLabelGenerator( new CategoryItemLabelGenerator("{1}", numberFormat, yAxisSymbols)); else if (dataLabelStyle.equals("pattern")) renderer.setItemLabelGenerator( new CategoryItemLabelGenerator("{1} {2} ({3} of {4})", numberFormat, yAxisSymbols)); else renderer.setItemLabelGenerator( new CategoryItemLabelGenerator(dataLabelStyle, numberFormat, yAxisSymbols)); } } // Add the renderer to the plot. // NOTE: this must be done before the setPaintStyle() call so the // DrawingSupplier object // will be set up properly for the generation of default colors. plot.setRenderer(num, renderer); // Set the paint style for this series (series 0) if (seriesData.getType().equals("bar") || seriesData.getType().equals("horizontalbar") || seriesData.getType().equals("area")) setPaintStyle(seriesData.getPaintStyle(), renderer, 0, height); num++; } // If gridLines was specified then we need to calculate the yAxisUnits if ((gridLines != -1) && (valueAxis instanceof NumberAxis)) { // Calculate the yAxisUnits we need to use to create the number of // gridLines yAxisUnits = calculateYAxisUnits(gridLines, minMax); // Set the yAxisUnits ((NumberAxis) valueAxis).setTickUnit(new NumberTickUnit(yAxisUnits)); } return plot; }
From source file:com.naryx.tagfusion.cfm.tag.awt.cfCHART.java
private XYPlot getXYPlot(List<cfCHARTSERIESData> series, String xAxisTitle, String yAxisTitle, String labelFormat, boolean bShowMarkers, int markerSize, boolean bShow3D, String tipStyle, String drillDownUrl, int xOffset, int yOffset, int yAxisUnits, String seriesPlacement, int height, int gridLines) throws cfmRunTimeException { // Create an XY plot XYPlot plot = new XYPlot(); ValueAxis domainAxis;/*from w w w . j a va 2 s . c o m*/ if (series.get(0).getSeriesDataType() == cfCHARTSERIESData.XY_NUMERIC_SERIES) { if (bShow3D) domainAxis = new NumberAxis3D(xAxisTitle); else domainAxis = new NumberAxis(xAxisTitle); } else { domainAxis = new DateAxis(xAxisTitle); } plot.setDomainAxis(domainAxis); ValueAxis valueAxis; DateFormat dateFormat = null; NumberFormat numberFormat = null; if (labelFormat.equals("date")) { valueAxis = new DateAxis(yAxisTitle); dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); ((DateAxis) valueAxis).setDateFormatOverride(dateFormat); } else { if (bShow3D) valueAxis = new NumberAxis3D(yAxisTitle); else valueAxis = new NumberAxis(yAxisTitle); if (labelFormat.equals("currency")) { ((NumberAxis) valueAxis).setNumberFormatOverride(NumberFormat.getCurrencyInstance()); numberFormat = NumberFormat.getCurrencyInstance(); } else if (labelFormat.equals("percent")) { numberFormat = NumberFormat.getPercentInstance(); numberFormat.setMaximumFractionDigits(3); // without this change .11443 // would be displayed as 11% // instead of 11.443% ((NumberAxis) valueAxis).setNumberFormatOverride(numberFormat); } else { numberFormat = NumberFormat.getInstance(); } if (yAxisUnits != 0) ((NumberAxis) valueAxis).setTickUnit(new NumberTickUnit(yAxisUnits)); } plot.setRangeAxis(valueAxis); // Add a dataset and renderer for each series int barChartDatasetIndex = -1; int hBarChartDatasetIndex = -1; int num = 0; MinMaxData minMax = new MinMaxData(); for (int i = 0; i < series.size(); i++) { cfCHARTSERIESData seriesData = series.get(i); XYSeriesCollection dataset; if ((barChartDatasetIndex != -1) && (seriesData.getType().equals("bar"))) { dataset = (XYSeriesCollection) plot.getDataset(barChartDatasetIndex); addSeriesDataToDataset(seriesData, dataset, minMax); // Set the paint style for this series setPaintStyle(seriesData.getPaintStyle(), plot.getRenderer(barChartDatasetIndex), dataset.getSeriesCount() - 1, height); // Add the color list for this series to the custom color renderer CustomColorRenderer cr = (CustomColorRenderer) plot.getRenderer(barChartDatasetIndex); cr.addColors(getColorList(seriesData)); continue; } else if ((hBarChartDatasetIndex != -1) && (seriesData.getType().equals("horizontalbar"))) { dataset = (XYSeriesCollection) plot.getDataset(hBarChartDatasetIndex); addSeriesDataToDataset(seriesData, dataset, minMax); // Set the paint style for this series setPaintStyle(seriesData.getPaintStyle(), plot.getRenderer(hBarChartDatasetIndex), dataset.getSeriesCount() - 1, height); // Add the color list for this series to the custom color renderer CustomColorRenderer cr = (CustomColorRenderer) plot.getRenderer(hBarChartDatasetIndex); cr.addColors(getColorList(seriesData)); continue; } else { dataset = new XYSeriesCollection(); addSeriesDataToDataset(seriesData, dataset, minMax); } plot.setDataset(num, dataset); XYItemRenderer renderer = null; if (seriesData.getType().equals("bar")) { plot.setOrientation(PlotOrientation.VERTICAL); renderer = getXYBarRenderer(seriesPlacement, bShow3D, xOffset, yOffset, getColorList(seriesData)); ItemLabelPosition position1 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER); renderer.setPositiveItemLabelPosition(position1); ItemLabelPosition position2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER); renderer.setNegativeItemLabelPosition(position2); ((XYBarRenderer) renderer).setMargin(0.2); // The margin between each // category barChartDatasetIndex = num; } else if (seriesData.getType().equals("horizontalbar")) { plot.setOrientation(PlotOrientation.HORIZONTAL); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); renderer = getXYBarRenderer(seriesPlacement, bShow3D, xOffset, yOffset, getColorList(seriesData)); ItemLabelPosition position1 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_LEFT); renderer.setPositiveItemLabelPosition(position1); ItemLabelPosition position2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE9, TextAnchor.CENTER_RIGHT); renderer.setNegativeItemLabelPosition(position2); ((XYBarRenderer) renderer).setMargin(0.2); // The margin between each // category hBarChartDatasetIndex = num; } else if (seriesData.getType().equals("line")) { renderer = new XYLineAndShapeRenderer(true, false); // Enable/Disable displaying of markers ((XYLineAndShapeRenderer) renderer).setShapesVisible(bShowMarkers); // Set the shape of the markers based on the markerSize value ((XYLineAndShapeRenderer) renderer).setShape(getMarker(seriesData.getMarkerStyle(), markerSize)); } else if (seriesData.getType().equals("area")) { renderer = new CustomXYAreaRenderer(); } else if (seriesData.getType().equals("step")) { renderer = new CustomXYStepRenderer(); } else if (seriesData.getType().equals("scatter")) { renderer = new XYLineAndShapeRenderer(false, true); // Set the shape of the markers based on the markerSize value ((XYLineAndShapeRenderer) renderer).setShape(getMarker(seriesData.getMarkerStyle(), markerSize)); } if (!tipStyle.equals("none")) { if (series.get(0).getSeriesDataType() == cfCHARTSERIESData.XY_DATE_SERIES) { renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator("{0}: {1}", DateFormat.getInstance(), DateFormat.getInstance())); } else { if (dateFormat != null) renderer.setBaseToolTipGenerator( new StandardXYToolTipGenerator("{0}: {2}", dateFormat, dateFormat)); else renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator("{0}: ({1}, {2})", numberFormat, NumberFormat.getInstance())); } } if (drillDownUrl != null) { if (dateFormat != null) renderer.setURLGenerator( new com.newatlanta.bluedragon.XYURLGenerator(drillDownUrl, dateFormat)); else renderer.setURLGenerator( new com.newatlanta.bluedragon.XYURLGenerator(drillDownUrl, numberFormat)); } if (seriesData.getSeriesColor() != null) renderer.setSeriesPaint(0, convertStringToColor(seriesData.getSeriesColor())); String dataLabelStyle = seriesData.getDataLabelStyle(); if (labelFormat.equals("date")) { if (dataLabelStyle.equals("none")) { renderer.setItemLabelsVisible(false); } else { setXYItemLabelsData(renderer, seriesData); if (dataLabelStyle.equals("value")) renderer.setItemLabelGenerator( new StandardXYItemLabelGenerator("{2}", dateFormat, dateFormat)); else if (dataLabelStyle.equals("rowlabel")) renderer.setItemLabelGenerator(new StandardXYItemLabelGenerator("{0}", NumberFormat.getInstance(), NumberFormat.getInstance())); else if (dataLabelStyle.equals("columnlabel")) renderer.setItemLabelGenerator(new StandardXYItemLabelGenerator("{1}", NumberFormat.getInstance(), NumberFormat.getInstance())); else if (dataLabelStyle.equals("pattern")) renderer.setItemLabelGenerator(new XYItemLabelGenerator("{2}", dateFormat, dateFormat)); else renderer.setItemLabelGenerator( new XYItemLabelGenerator(dataLabelStyle, dateFormat, dateFormat)); } } else { if (dataLabelStyle.equals("none")) { renderer.setItemLabelsVisible(false); } else { setXYItemLabelsData(renderer, seriesData); if (dataLabelStyle.equals("value")) { renderer.setItemLabelGenerator( new StandardXYItemLabelGenerator("{2}", numberFormat, numberFormat)); } else if (dataLabelStyle.equals("rowlabel")) { renderer.setItemLabelGenerator( new StandardXYItemLabelGenerator("{0}", numberFormat, numberFormat)); } else if (dataLabelStyle.equals("columnlabel")) { if (series.get(0).getSeriesDataType() == cfCHARTSERIESData.XY_DATE_SERIES) { renderer.setItemLabelGenerator(new StandardXYItemLabelGenerator("{1}", SimpleDateFormat.getInstance(), NumberFormat.getInstance())); } else { renderer.setItemLabelGenerator(new StandardXYItemLabelGenerator("{1}", NumberFormat.getInstance(), NumberFormat.getInstance())); } } else if (dataLabelStyle.equals("pattern")) { if (series.get(0).getSeriesDataType() == cfCHARTSERIESData.XY_DATE_SERIES) { renderer.setItemLabelGenerator(new XYItemLabelGenerator("{1} {2} ({3} of {4})", SimpleDateFormat.getInstance(), numberFormat)); } else { renderer.setItemLabelGenerator(new XYItemLabelGenerator("{1} {2} ({3} of {4})", NumberFormat.getInstance(), numberFormat)); } } else { renderer.setItemLabelGenerator( new XYItemLabelGenerator(dataLabelStyle, NumberFormat.getInstance(), numberFormat)); } } } // Add the renderer to the plot. // NOTE: this must be done before the setPaintStyle() call so the // DrawingSupplier object // will be set up properly for the generation of default colors. plot.setRenderer(num, renderer); // Set the paint style for this series (series 0) if (seriesData.getType().equals("bar") || seriesData.getType().equals("horizontalbar") || seriesData.getType().equals("area")) setPaintStyle(seriesData.getPaintStyle(), renderer, 0, height); num++; } // If gridLines was specified then we need to calculate the yAxisUnits if ((gridLines != -1) && (valueAxis instanceof NumberAxis)) { // Calculate the yAxisUnits we need to use to create the number of // gridLines yAxisUnits = calculateYAxisUnits(gridLines, minMax); // Set the yAxisUnits ((NumberAxis) valueAxis).setTickUnit(new NumberTickUnit(yAxisUnits)); } return plot; }
From source file:com.codename1.impl.android.AndroidImplementation.java
/** * @inheritDoc//from w ww .j ava 2s . co m */ public L10NManager getLocalizationManager() { if (l10n == null) { Locale l = Locale.getDefault(); l10n = new L10NManager(l.getLanguage(), l.getCountry()) { public double parseDouble(String localeFormattedDecimal) { try { return NumberFormat.getNumberInstance().parse(localeFormattedDecimal).doubleValue(); } catch (ParseException err) { return Double.parseDouble(localeFormattedDecimal); } } public String format(int number) { return NumberFormat.getNumberInstance().format(number); } public String format(double number) { return NumberFormat.getNumberInstance().format(number); } public String formatCurrency(double currency) { return NumberFormat.getCurrencyInstance().format(currency); } public String formatDateLongStyle(Date d) { return DateFormat.getDateInstance(DateFormat.LONG).format(d); } public String formatDateShortStyle(Date d) { return DateFormat.getDateInstance(DateFormat.SHORT).format(d); } public String formatDateTime(Date d) { return DateFormat.getDateTimeInstance().format(d); } public String formatDateTimeMedium(Date d) { DateFormat dd = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM); return dd.format(d); } public String formatDateTimeShort(Date d) { DateFormat dd = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); return dd.format(d); } public String getCurrencySymbol() { return NumberFormat.getInstance().getCurrency().getSymbol(); } public void setLocale(String locale, String language) { super.setLocale(locale, language); Locale l = new Locale(language, locale); Locale.setDefault(l); } }; } return l10n; }