List of usage examples for java.text DecimalFormat applyPattern
public void applyPattern(String pattern)
From source file:name.gumartinm.weather.information.fragment.current.CurrentFragment.java
private void updateUI(final Current current) { // 1. Update units of measurement. final UnitsConversor tempUnitsConversor = new TempUnitsConversor( this.getActivity().getApplicationContext()); final UnitsConversor windConversor = new WindUnitsConversor(this.getActivity().getApplicationContext()); final UnitsConversor pressureConversor = new PressureUnitsConversor( this.getActivity().getApplicationContext()); // 2. Formatters final DecimalFormat numberFormatter = (DecimalFormat) NumberFormat.getNumberInstance(Locale.US); numberFormatter.applyPattern("###.##"); final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss", Locale.US); // 3. Prepare data for UI. String tempMax = ""; if (current.getMain().getTemp_max() != null) { double conversion = (Double) current.getMain().getTemp_max(); conversion = tempUnitsConversor.doConversion(conversion); tempMax = numberFormatter.format(conversion) + tempUnitsConversor.getSymbol(); }// ww w . ja v a2 s .c om String tempMin = ""; if (current.getMain().getTemp_min() != null) { double conversion = (Double) current.getMain().getTemp_min(); conversion = tempUnitsConversor.doConversion(conversion); tempMin = numberFormatter.format(conversion) + tempUnitsConversor.getSymbol(); } Bitmap picture; if ((current.getWeather().size() > 0) && (current.getWeather().get(0).getIcon() != null) && (IconsList.getIcon(current.getWeather().get(0).getIcon()) != null)) { final String icon = current.getWeather().get(0).getIcon(); picture = BitmapFactory.decodeResource(this.getResources(), IconsList.getIcon(icon).getResourceDrawable()); } else { picture = BitmapFactory.decodeResource(this.getResources(), R.drawable.weather_severe_alert); } String description = this.getString(R.string.text_field_description_when_error); if (current.getWeather().size() > 0) { description = current.getWeather().get(0).getDescription(); } String humidityValue = ""; if ((current.getMain() != null) && (current.getMain().getHumidity() != null)) { final double conversion = (Double) current.getMain().getHumidity(); humidityValue = numberFormatter.format(conversion); } String pressureValue = ""; if ((current.getMain() != null) && (current.getMain().getPressure() != null)) { double conversion = (Double) current.getMain().getPressure(); conversion = pressureConversor.doConversion(conversion); pressureValue = numberFormatter.format(conversion); } String windValue = ""; if ((current.getWind() != null) && (current.getWind().getSpeed() != null)) { double conversion = (Double) current.getWind().getSpeed(); conversion = windConversor.doConversion(conversion); windValue = numberFormatter.format(conversion); } String rainValue = ""; if ((current.getRain() != null) && (current.getRain().get3h() != null)) { final double conversion = (Double) current.getRain().get3h(); rainValue = numberFormatter.format(conversion); } String cloudsValue = ""; if ((current.getClouds() != null) && (current.getClouds().getAll() != null)) { final double conversion = (Double) current.getClouds().getAll(); cloudsValue = numberFormatter.format(conversion); } String snowValue = ""; if ((current.getSnow() != null) && (current.getSnow().get3h() != null)) { final double conversion = (Double) current.getSnow().get3h(); snowValue = numberFormatter.format(conversion); } String feelsLike = ""; if (current.getMain().getTemp() != null) { double conversion = (Double) current.getMain().getTemp(); conversion = tempUnitsConversor.doConversion(conversion); feelsLike = numberFormatter.format(conversion); } String sunRiseTime = ""; if (current.getSys().getSunrise() != null) { final long unixTime = (Long) current.getSys().getSunrise(); final Date unixDate = new Date(unixTime * 1000L); sunRiseTime = dateFormat.format(unixDate); } String sunSetTime = ""; if (current.getSys().getSunset() != null) { final long unixTime = (Long) current.getSys().getSunset(); final Date unixDate = new Date(unixTime * 1000L); sunSetTime = dateFormat.format(unixDate); } // 4. Update UI. final TextView tempMaxView = (TextView) getActivity().findViewById(R.id.weather_current_temp_max); tempMaxView.setText(tempMax); final TextView tempMinView = (TextView) getActivity().findViewById(R.id.weather_current_temp_min); tempMinView.setText(tempMin); final ImageView pictureView = (ImageView) getActivity().findViewById(R.id.weather_current_picture); pictureView.setImageBitmap(picture); final TextView descriptionView = (TextView) getActivity().findViewById(R.id.weather_current_description); descriptionView.setText(description); ((TextView) getActivity().findViewById(R.id.weather_current_humidity_value)).setText(humidityValue); ((TextView) getActivity().findViewById(R.id.weather_current_humidity_units)) .setText(this.getActivity().getApplicationContext().getString(R.string.text_units_percent)); ((TextView) getActivity().findViewById(R.id.weather_current_pressure_value)).setText(pressureValue); ((TextView) getActivity().findViewById(R.id.weather_current_pressure_units)) .setText(pressureConversor.getSymbol()); ((TextView) getActivity().findViewById(R.id.weather_current_wind_value)).setText(windValue); ((TextView) getActivity().findViewById(R.id.weather_current_wind_units)).setText(windConversor.getSymbol()); ((TextView) getActivity().findViewById(R.id.weather_current_rain_value)).setText(rainValue); ((TextView) getActivity().findViewById(R.id.weather_current_rain_units)) .setText(this.getActivity().getApplicationContext().getString(R.string.text_units_mm3h)); ((TextView) getActivity().findViewById(R.id.weather_current_clouds_value)).setText(cloudsValue); ((TextView) getActivity().findViewById(R.id.weather_current_clouds_units)) .setText(this.getActivity().getApplicationContext().getString(R.string.text_units_percent)); ((TextView) getActivity().findViewById(R.id.weather_current_snow_value)).setText(snowValue); ((TextView) getActivity().findViewById(R.id.weather_current_snow_units)) .setText(this.getActivity().getApplicationContext().getString(R.string.text_units_mm3h)); ((TextView) getActivity().findViewById(R.id.weather_current_feelslike_value)).setText(feelsLike); ((TextView) getActivity().findViewById(R.id.weather_current_feelslike_units)) .setText(tempUnitsConversor.getSymbol()); ((TextView) getActivity().findViewById(R.id.weather_current_sunrise_value)).setText(sunRiseTime); ((TextView) getActivity().findViewById(R.id.weather_current_sunset_value)).setText(sunSetTime); this.getActivity().findViewById(R.id.weather_current_data_container).setVisibility(View.VISIBLE); this.getActivity().findViewById(R.id.weather_current_progressbar).setVisibility(View.GONE); this.getActivity().findViewById(R.id.weather_current_error_message).setVisibility(View.GONE); }
From source file:org.opensingular.form.wicket.mapper.MoneyMapper.java
@Override public String getReadOnlyFormattedText(WicketBuildContext ctx, IModel<? extends SInstance> model) { final SInstance mi = model.getObject(); if ((mi != null) && (mi.getValue() != null)) { final NumberFormat numberFormat = NumberFormat.getInstance(new Locale("pt", "BR")); final DecimalFormat decimalFormat = (DecimalFormat) numberFormat; final BigDecimal valor = (BigDecimal) mi.getValue(); final Map<String, Object> options = withOptionsOf(model); final Integer digitos = (Integer) options.get(PRECISION); final StringBuilder pattern = new StringBuilder(); pattern.append("R$ ###,###."); for (int i = 0; i < digitos; i += 1) { pattern.append('#'); }//from ww w. ja v a 2 s. c o m decimalFormat.applyPattern(pattern.toString()); decimalFormat.setMinimumFractionDigits(digitos); return decimalFormat.format(valor); } return StringUtils.EMPTY; }
From source file:net.sf.jasperreports.functions.standard.TextFunctions.java
/** * Converts a number into a text string according to a specified format. *///from w w w . j a v a 2s . co m @Function("TEXT") @FunctionParameters({ @FunctionParameter("number"), @FunctionParameter("numberFormat") }) public String TEXT(Number number, String numberFormat) { if (number == null || numberFormat == null) { logNullTextString(); return null; } else { DecimalFormat nformat = getDecimalFormat(); nformat.applyPattern(numberFormat); return nformat.format(number); } }
From source file:net.sf.jasperreports.functions.standard.TextFunctions.java
public String FIXED(Number number, Integer decimals, Boolean omitSeparators) { if (number == null || decimals == null || omitSeparators == null) { logHavingNullArguments();/*from w ww . j a v a 2s . com*/ return null; } // Pattern samples: // 123456.789 ###,###.### 123,456.789 // 123456.789 ###.## 123456.79 // 123.78 000000.000 000123.780 StringBuilder patternBuf = new StringBuilder("###"); if (!omitSeparators) { patternBuf.append(",###"); } patternBuf.append("."); for (int i = 0; i < decimals; i++) { patternBuf.append("0"); } DecimalFormat myFormatter = getDecimalFormat(); myFormatter.applyPattern(patternBuf.toString()); return myFormatter.format(number); }
From source file:paquete.Ventana.java
private void jButtonBanderaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBanderaActionPerformed //Incremento el Numero de Ticket contadorTicket++;/*from www . ja va 2 s. co m*/ DecimalFormat formato = new DecimalFormat("00000"); jTextAreaTicket.setText(""); jTextAreaTicket.append("TICKET\n======\n"); jTextAreaTicket.append("N ticket: " + formato.format(contadorTicket) + "\n"); // Obtenenmos la Fecha Actual formato.applyPattern("00"); Calendar rightNow = Calendar.getInstance(); iniMilisegundos = rightNow.getTimeInMillis(); //Mostramos la Fecha en formato DD-MM-YYYY SimpleDateFormat horaActual = new SimpleDateFormat("d-M-y"); jTextAreaTicket.append("Fecha: " + horaActual.format(rightNow.getTime()) + "\n\n"); //Mostramos la Hora en formato HH:MI:SS horaActual.applyPattern("HH:mm:ss"); jTextAreaTicket.append("Hora bajada de bandera: " + horaActual.format(rightNow.getTime()) + "\n"); //Ponemos las coordenadas muestraCoordenadas(); // Cambiamos de orden la habilitacion de botones jButtonBandera.setEnabled(false); jButtonFin.setEnabled(true); }
From source file:eu.ggnet.dwoss.misc.op.listings.SalesListingProducerOperation.java
/** * Generates PDF files for units in a specific sales channel. * The lists are seperated by brand.//from w ww . ja v a 2 s . c om * <p> * @param channel the saleschannel * @return PDF files for units in a specific sales channel. */ private Map<TradeName, Collection<FileJacket>> generatePdfListings(SalesChannel channel) throws UserInfoException { SubMonitor m = monitorFactory.newSubMonitor("Endkundenlisten erstellen", 10); m.message("lade Gertedaten"); m.start(); List<StockUnit> stockUnits = new StockUnitEao(stockEm).findByNoLogicTransaction(); List<UniqueUnit> uniqueUnits = new UniqueUnitEao(uuEm).findByIds(toUniqueUnitIds(stockUnits)); PriceType priceType = (channel == SalesChannel.CUSTOMER ? PriceType.CUSTOMER : PriceType.RETAILER); m.worked(2, "prfe und filtere Gerte"); SortedMap<UniqueUnit, StockUnit> uusus = toSortedMap(uniqueUnits, stockUnits, new UniqueUnitComparator()); for (Iterator<Map.Entry<UniqueUnit, StockUnit>> it = uusus.entrySet().iterator(); it.hasNext();) { Map.Entry<UniqueUnit, StockUnit> entry = it.next(); UniqueUnit uu = entry.getKey(); StockUnit su = entry.getValue(); if (uu == null) throw new NullPointerException(su + " has no UniqueUnit, Database Error"); if (uu.getSalesChannel() != channel || !uu.hasPrice(priceType) || su.isInTransaction()) { it.remove(); } } L.info("Selected {} Units for the Lists", uusus.size()); m.worked(1, "sortiere und bereite Gerte vor"); Map<Product, Set<UniqueUnit>> stackedUnits = new HashMap<>(); for (Map.Entry<UniqueUnit, StockUnit> entry : uusus.entrySet()) { Product p = entry.getKey().getProduct(); if (!stackedUnits.containsKey(p)) stackedUnits.put(p, new HashSet<>()); stackedUnits.get(p).add(entry.getKey()); } List<StackedLine> stackedLines = new ArrayList<>(stackedUnits.size()); DecimalFormat df = (DecimalFormat) DecimalFormat.getInstance(Locale.GERMAN); df.applyPattern("#,###,##0.00"); for (Map.Entry<Product, Set<UniqueUnit>> entry : stackedUnits.entrySet()) { Product p = entry.getKey(); StackedLine line = new StackedLine(); line.setBrand(p.getTradeName()); line.setGroup(p.getGroup()); line.setCommodityGroupName(p.getGroup().getNote()); line.setDescription(p.getDescription()); line.setManufacturerName(p.getTradeName().getName()); line.setManufacturerPartNo(p.getPartNo()); line.setName(p.getName()); line.setImageUrl(imageFinder.findImageUrl(p.getImageId())); boolean priceChanged = false; double customerPrice = 0; for (UniqueUnit uu : entry.getValue()) { StackedLineUnit elem = new StackedLineUnit(); elem.setAccessories(UniqueUnitFormater.toSingleLineAccessories(uu)); elem.setComment(UniqueUnitFormater.toSingleLineComment(uu)); elem.setConditionLevelDescription(uu.getCondition().getNote()); elem.setMfgDate(uu.getMfgDate()); elem.setRefurbishedId(uu.getRefurbishId()); elem.setSerial(uu.getSerial()); elem.setWarranty(uu.getWarranty().getName()); if (uu.getWarranty().equals(Warranty.WARRANTY_TILL_DATE)) elem.setWarrentyTill(uu.getWarrentyValid()); double uuPrice = uu.getPrice(priceType); elem.setCustomerPrice(uuPrice); elem.setRoundedTaxedCustomerPrice(MathUtil.roundedApply(uuPrice, GlobalConfig.TAX, 0.02)); // For the "ab XXX" handler if (customerPrice == 0) { customerPrice = uuPrice; } else if (customerPrice > uuPrice) { customerPrice = uuPrice; priceChanged = true; } else if (customerPrice < uuPrice) { priceChanged = true; } elem.normaize(); line.add(elem); } line.setAmount(line.getUnits().size()); line.setCustomerPriceLabel((priceChanged ? "ab " : "") + df.format(MathUtil.roundedApply(customerPrice, GlobalConfig.TAX, 0.02))); line.normaize(); stackedLines.add(line); } L.info("Created {} Lines for the Lists", stackedLines.size()); m.worked(1, "erzeuge listen"); Set<ListingConfiguration> configs = new HashSet<>(); if (listingService.isAmbiguous() || listingService.isUnsatisfied()) { for (TradeName brand : TradeName.values()) { for (ProductGroup value : ProductGroup.values()) { configs.add(ListingConfiguration.builder().filePrefix("Gerteliste ") .name(brand.getName() + " " + value.getName()).brand(brand).groups(EnumSet.of(value)) .headLeft("Beispieltext Links\nZeile 2").headCenter("Beispieltext Mitte\nZeile 2") .headRight("Beispieltext Rechts\nZeile 2").footer("Fusszeilentext").build()); } } } else { configs.addAll(listingService.get().listingConfigurations()); } m.setWorkRemaining(configs.size() + 1); Map<TradeName, Collection<FileJacket>> jackets = new HashMap<>(); for (ListingConfiguration config : configs) { m.worked(1, "erstelle Liste " + config.getName()); if (StringUtils.isBlank(config.getJasperTemplateFile())) config.setJasperTemplateFile(compileReportToTempFile("CustomerSalesListing")); if (StringUtils.isBlank(config.getJasperTempleteUnitsFile())) config.setJasperTempleteUnitsFile(compileReportToTempFile("CustomerSalesListingUnits")); FileJacket fj = createListing(config, stackedLines); if (fj != null) { if (!jackets.containsKey(config.getBrand())) jackets.put(config.getBrand(), new HashSet<>()); jackets.get(config.getBrand()).add(fj); } } m.finish(); return jackets; }
From source file:org.sparkcommerce.openadmin.server.service.persistence.module.provider.BasicFieldPersistenceProvider.java
@Override public FieldProviderResponse extractValue(ExtractValueRequest extractValueRequest, Property property) throws PersistenceException { if (!canHandleExtraction(extractValueRequest, property)) { return FieldProviderResponse.NOT_HANDLED; }/*from ww w . j av a2 s . c om*/ try { if (extractValueRequest.getRequestedValue() != null) { String val = null; if (extractValueRequest.getMetadata().getForeignKeyCollection()) { ((BasicFieldMetadata) property.getMetadata()) .setFieldType(extractValueRequest.getMetadata().getFieldType()); } else if (extractValueRequest.getMetadata().getFieldType().equals(SupportedFieldType.BOOLEAN) && extractValueRequest.getRequestedValue() instanceof Character) { val = (extractValueRequest.getRequestedValue().equals('Y')) ? "true" : "false"; } else if (Date.class.isAssignableFrom(extractValueRequest.getRequestedValue().getClass())) { val = extractValueRequest.getDataFormatProvider().getSimpleDateFormatter() .format((Date) extractValueRequest.getRequestedValue()); } else if (Timestamp.class.isAssignableFrom(extractValueRequest.getRequestedValue().getClass())) { val = extractValueRequest.getDataFormatProvider().getSimpleDateFormatter() .format(new Date(((Timestamp) extractValueRequest.getRequestedValue()).getTime())); } else if (Calendar.class.isAssignableFrom(extractValueRequest.getRequestedValue().getClass())) { val = extractValueRequest.getDataFormatProvider().getSimpleDateFormatter() .format(((Calendar) extractValueRequest.getRequestedValue()).getTime()); } else if (Double.class.isAssignableFrom(extractValueRequest.getRequestedValue().getClass())) { val = extractValueRequest.getDataFormatProvider().getDecimalFormatter() .format(extractValueRequest.getRequestedValue()); } else if (BigDecimal.class.isAssignableFrom(extractValueRequest.getRequestedValue().getClass())) { BigDecimal decimal = (BigDecimal) extractValueRequest.getRequestedValue(); DecimalFormat format = extractValueRequest.getDataFormatProvider().getDecimalFormatter(); //track all the decimal places in the scale of the BigDecimal - even if they're all zeros StringBuilder sb = new StringBuilder(); sb.append("0"); if (decimal.scale() > 0) { sb.append("."); for (int j = 0; j < decimal.scale(); j++) { sb.append("0"); } } format.applyPattern(sb.toString()); val = format.format(extractValueRequest.getRequestedValue()); } else if (extractValueRequest.getMetadata().getForeignKeyClass() != null) { try { val = extractValueRequest.getFieldManager() .getFieldValue(extractValueRequest.getRequestedValue(), extractValueRequest.getMetadata().getForeignKeyProperty()) .toString(); //see if there's a name property and use it for the display value String entityName = null; if (extractValueRequest.getRequestedValue() instanceof AdminMainEntity) { entityName = ((AdminMainEntity) extractValueRequest.getRequestedValue()) .getMainEntityName(); } Object temp = null; if (!StringUtils .isEmpty(extractValueRequest.getMetadata().getForeignKeyDisplayValueProperty())) { String nameProperty = extractValueRequest.getMetadata() .getForeignKeyDisplayValueProperty(); try { temp = extractValueRequest.getFieldManager() .getFieldValue(extractValueRequest.getRequestedValue(), nameProperty); } catch (FieldNotAvailableException e) { //do nothing } } if (temp == null && StringUtils.isEmpty(entityName)) { try { temp = extractValueRequest.getFieldManager() .getFieldValue(extractValueRequest.getRequestedValue(), "name"); } catch (FieldNotAvailableException e) { //do nothing } } if (temp != null) { extractValueRequest.setDisplayVal(temp.toString()); } else if (!StringUtils.isEmpty(entityName)) { extractValueRequest.setDisplayVal(entityName); } } catch (FieldNotAvailableException e) { throw new IllegalArgumentException(e); } } else { val = extractValueRequest.getRequestedValue().toString(); } property.setValue(val); property.setDisplayValue(extractValueRequest.getDisplayVal()); } } catch (IllegalAccessException e) { throw new PersistenceException(e); } return FieldProviderResponse.HANDLED; }
From source file:org.broadleafcommerce.openadmin.server.service.persistence.module.provider.BasicFieldPersistenceProvider.java
@Override public FieldProviderResponse extractValue(ExtractValueRequest extractValueRequest, Property property) throws PersistenceException { if (!canHandleExtraction(extractValueRequest, property)) { return FieldProviderResponse.NOT_HANDLED; }/*from www . ja v a 2 s. c o m*/ try { if (extractValueRequest.getRequestedValue() != null) { String val = null; if (extractValueRequest.getMetadata().getForeignKeyCollection()) { ((BasicFieldMetadata) property.getMetadata()) .setFieldType(extractValueRequest.getMetadata().getFieldType()); } else if (extractValueRequest.getMetadata().getFieldType().equals(SupportedFieldType.BOOLEAN) && extractValueRequest.getRequestedValue() instanceof Character) { val = (extractValueRequest.getRequestedValue().equals('Y')) ? "true" : "false"; } else if (Date.class.isAssignableFrom(extractValueRequest.getRequestedValue().getClass())) { val = extractValueRequest.getDataFormatProvider().getSimpleDateFormatter() .format((Date) extractValueRequest.getRequestedValue()); } else if (Timestamp.class.isAssignableFrom(extractValueRequest.getRequestedValue().getClass())) { val = extractValueRequest.getDataFormatProvider().getSimpleDateFormatter() .format(new Date(((Timestamp) extractValueRequest.getRequestedValue()).getTime())); } else if (Calendar.class.isAssignableFrom(extractValueRequest.getRequestedValue().getClass())) { val = extractValueRequest.getDataFormatProvider().getSimpleDateFormatter() .format(((Calendar) extractValueRequest.getRequestedValue()).getTime()); } else if (Double.class.isAssignableFrom(extractValueRequest.getRequestedValue().getClass())) { val = extractValueRequest.getDataFormatProvider().getDecimalFormatter() .format(extractValueRequest.getRequestedValue()); } else if (BigDecimal.class.isAssignableFrom(extractValueRequest.getRequestedValue().getClass())) { BigDecimal decimal = (BigDecimal) extractValueRequest.getRequestedValue(); DecimalFormat format = extractValueRequest.getDataFormatProvider().getDecimalFormatter(); //track all the decimal places in the scale of the BigDecimal - even if they're all zeros StringBuilder sb = new StringBuilder(); sb.append("0"); if (decimal.scale() > 0) { sb.append("."); for (int j = 0; j < decimal.scale(); j++) { sb.append("0"); } } format.applyPattern(sb.toString()); val = format.format(extractValueRequest.getRequestedValue()); } else if (extractValueRequest.getMetadata().getForeignKeyClass() != null) { try { val = extractValueRequest.getFieldManager() .getFieldValue(extractValueRequest.getRequestedValue(), extractValueRequest.getMetadata().getForeignKeyProperty()) .toString(); if (extensionManager != null) { ExtensionResultHolder<Serializable> resultHolder = new ExtensionResultHolder<Serializable>(); ExtensionResultStatusType result = extensionManager.getProxy() .transformForeignKey(extractValueRequest, property, resultHolder); if (ExtensionResultStatusType.NOT_HANDLED != result && resultHolder.getResult() != null) { val = String.valueOf(resultHolder.getResult()); } } //see if there's a name property and use it for the display value String entityName = null; if (extractValueRequest.getRequestedValue() instanceof AdminMainEntity) { entityName = ((AdminMainEntity) extractValueRequest.getRequestedValue()) .getMainEntityName(); } Object temp = null; if (!StringUtils .isEmpty(extractValueRequest.getMetadata().getForeignKeyDisplayValueProperty())) { String nameProperty = extractValueRequest.getMetadata() .getForeignKeyDisplayValueProperty(); try { temp = extractValueRequest.getFieldManager() .getFieldValue(extractValueRequest.getRequestedValue(), nameProperty); } catch (FieldNotAvailableException e) { //do nothing } } if (temp == null && StringUtils.isEmpty(entityName)) { try { temp = extractValueRequest.getFieldManager() .getFieldValue(extractValueRequest.getRequestedValue(), "name"); } catch (FieldNotAvailableException e) { //do nothing } } if (temp != null) { extractValueRequest.setDisplayVal(temp.toString()); } else if (!StringUtils.isEmpty(entityName)) { extractValueRequest.setDisplayVal(entityName); } } catch (FieldNotAvailableException e) { throw new IllegalArgumentException(e); } } else if (SupportedFieldType.ID == extractValueRequest.getMetadata().getFieldType()) { val = extractValueRequest.getRequestedValue().toString(); if (extensionManager != null) { ExtensionResultHolder<Serializable> resultHolder = new ExtensionResultHolder<Serializable>(); ExtensionResultStatusType result = extensionManager.getProxy() .transformId(extractValueRequest, property, resultHolder); if (ExtensionResultStatusType.NOT_HANDLED != result && resultHolder.getResult() != null) { val = String.valueOf(resultHolder.getResult()); } } } else { val = extractValueRequest.getRequestedValue().toString(); } property.setValue(val); property.setDisplayValue(extractValueRequest.getDisplayVal()); } } catch (IllegalAccessException e) { throw new PersistenceException(e); } return FieldProviderResponse.HANDLED; }
From source file:org.sparkcommerce.openadmin.server.service.persistence.module.BasicPersistenceModule.java
@Override public DecimalFormat getDecimalFormatter() { SparkRequestContext brc = SparkRequestContext.getSparkRequestContext(); Locale locale = brc.getJavaLocale(); DecimalFormat format = (DecimalFormat) NumberFormat.getInstance(locale); format.applyPattern("0.########"); format.setGroupingUsed(false);/* w w w .j a v a 2 s . c o m*/ return format; }